mirror of
https://github.com/golang/go.git
synced 2026-02-02 00:52:04 +03:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8aec4095e | ||
|
|
b8c9ef9f09 | ||
|
|
136f4a6b2a | ||
|
|
867be4c60c | ||
|
|
9a4e7942ea | ||
|
|
ff38035a62 | ||
|
|
42046e8989 | ||
|
|
fbf7e1f295 | ||
|
|
21312a4b5e | ||
|
|
5927854f7d | ||
|
|
65717b2dca | ||
|
|
048c9cfaac | ||
|
|
cff0de3da3 | ||
|
|
579120323f | ||
|
|
380525598c | ||
|
|
f096b5b340 | ||
|
|
3e3da54633 | ||
|
|
9b1e7cf2ac | ||
|
|
b01db023b1 | ||
|
|
a279b53a18 | ||
|
|
909f409a8d | ||
|
|
58ad0176ca | ||
|
|
92dac21d29 | ||
|
|
9bb98e02de | ||
|
|
78d74fc2cd | ||
|
|
5495047223 | ||
|
|
890e0e862f | ||
|
|
be596f049a | ||
|
|
0173631d53 | ||
|
|
ac0ccf3cd2 | ||
|
|
cc402c2c4d | ||
|
|
f396fa4285 | ||
|
|
664cd26c89 | ||
|
|
a8730cd93a | ||
|
|
b63db76c4a | ||
|
|
193eda7291 | ||
|
|
6f08c935a9 | ||
|
|
f20944de78 | ||
|
|
196492a299 | ||
|
|
1a6d87d4bf | ||
|
|
623e2c4603 | ||
|
|
780249eed4 | ||
|
|
31b2c4cc25 | ||
|
|
ac29f30dbb | ||
|
|
7320506bc5 | ||
|
|
45a4609c0a | ||
|
|
e157fac02d | ||
|
|
835dfef939 | ||
|
|
df91b8044d | ||
|
|
3d9475c04b | ||
|
|
b9661a14ea | ||
|
|
65c6c88a94 | ||
|
|
fbc9b49790 |
0
.github/SUPPORT → .github/SUPPORT.md
vendored
0
.github/SUPPORT → .github/SUPPORT.md
vendored
@@ -34,6 +34,7 @@ We encourage all Go users to subscribe to
|
||||
<p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="/doc/go1.9">Go 1.9</a> <small>(August 2017)</small></li>
|
||||
<li><a href="/doc/go1.8">Go 1.8</a> <small>(February 2017)</small></li>
|
||||
<li><a href="/doc/go1.7">Go 1.7</a> <small>(August 2016)</small></li>
|
||||
<li><a href="/doc/go1.6">Go 1.6</a> <small>(February 2016)</small></li>
|
||||
|
||||
@@ -20,7 +20,14 @@ For example, Go 1.8 is supported until Go 1.10 is released,
|
||||
and Go 1.9 is supported until Go 1.11 is released.
|
||||
We fix critical problems, including <a href="/security">critical security problems</a>,
|
||||
in supported releases as needed by issuing minor revisions
|
||||
(for example, Go 1.8.1, Go 1.8.2, and so on).
|
||||
(for example, Go 1.9.1, Go 1.9.2, and so on).
|
||||
</p>
|
||||
|
||||
<h2 id="go1.9">go1.9 (released 2017/08/24)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.9 is a major release of Go.
|
||||
Read the <a href="/doc/go1.9">Go 1.9 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.8">go1.8 (released 2017/02/16)</h2>
|
||||
|
||||
@@ -19,11 +19,12 @@ editing, navigation, testing, and debugging experience.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/fatih/vim-go">Vim Go</a>: a plugin for Vim to provide Go programming language support</li>
|
||||
<li><a href="https://marketplace.visualstudio.com/items?itemName=lukehoban.Go">Visual Studio Code Go</a>:
|
||||
an extension for Visual Studio Code to provide support for the Go programming language</li>
|
||||
<li><a href="https://github.com/fatih/vim-go">vim</a>: vim-go plugin provides Go programming language support</li>
|
||||
<li><a href="https://marketplace.visualstudio.com/items?itemName=lukehoban.Go">Visual Studio Code</a>:
|
||||
Go extension provides support for the Go programming language</li>
|
||||
<li><a href="https://www.jetbrains.com/go">Gogland</a>: Gogland is distributed either as a standalone IDE
|
||||
or as a plugin for the IntelliJ Platform IDEs</li>
|
||||
or as a plugin for the commercial IntelliJ Platform IDEs</li>
|
||||
<li><a href="https://atom.io/packages/go-plus">Atom</a>: Go-Plus is an Atom package that provides enhanced Go support</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
@@ -41,133 +42,155 @@ The following feature matrix lists and compares the most significant features.
|
||||
<table class="features-matrix">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><img title="Vim Go" src="/doc/editors/vimgo.png"><br>Vim Go</th>
|
||||
<th><img title="Visual Studio Code" src="/doc/editors/vscodego.png"><br>Visual Studio Code Go</th>
|
||||
<th><img title="Vim Go" src="/doc/editors/vimgo.png"><br>vim</th>
|
||||
<th><img title="Visual Studio Code" src="/doc/editors/vscodego.png"><br>Visual Studio Code</th>
|
||||
<th><img title="Gogland" src="/doc/editors/gogland.png"><br>Gogland</th>
|
||||
<th><img title="Go-Plus" src="/doc/editors/go-plus.png"><br>Atom</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="feature-row" colspan="4">Editing features</td>
|
||||
<td class="feature-row" colspan="5">Editing features</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Build and run from the editor/IDE</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Autocompletion of identifers (variable, method, and function names)</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Autocompletion based on type</td>
|
||||
<td class="no">No</td>
|
||||
<td class="no">No</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type-aware autocompletion</td>
|
||||
<td class="no">No</td>
|
||||
<td class="no">No</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="no">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rename identifiers</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Auto format, build, vet, and lint on save</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes<sup>1</sup></td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Auto insert import paths and remove unused on save</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes<sup>2</sup></td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Auto generate JSON, XML tags for struct fields</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="feature-row" colspan="4">Navigation features</td>
|
||||
<td class="feature-row" colspan="5">Navigation features</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Display documentation inline, or open godoc in browser</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Switch between <code>*.go</code> and <code>*_test.go</code> file</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Jump to definition and referees</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Look up for interface implementations</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Search for callers and callees</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="feature-row" colspan="4">Testing and debugging features</td>
|
||||
<td class="feature-row" colspan="5">Testing and debugging features</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Debugger support</td>
|
||||
<td class="no">No</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes<sup>3</sup></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Run a single test case, all tests from file, or all tests from a package</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="no">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Auto generate tests for packages, files and identifiers</td>
|
||||
<td class="no">No</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="no">No</td>
|
||||
<td class="no">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Debug tests</td>
|
||||
<td class="no">No</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes<sup>3</sup></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Display test coverage</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
<td class="yes">Yes</td>
|
||||
</tr>
|
||||
<tr class="download">
|
||||
<td></td>
|
||||
<td><a href="https://github.com/fatih/vim-go">Install<a/></td>
|
||||
<td><a href="https://marketplace.visualstudio.com/items?itemName=lukehoban.Go">Install<a/></td>
|
||||
<td><a href="https://www.jetbrains.com/go">Install<a/></td>
|
||||
<td><a href="https://atom.io/packages/go-plus">Install</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<sup>1</sup>: Possible when enabled via Settings > Go > On Save, <code>go</code> <code>vet</code> and <code>golint</code> are available via plugins. Also runs tests on save if configured.
|
||||
<sup>1</sup>Possible when enabled via Settings > Go > On Save, <code>go</code> <code>vet</code> and <code>golint</code> are available via plugins. Also runs tests on save if configured.
|
||||
<br>
|
||||
<sup>2</sup>: Additionally, user input can disambiguate when two or more options are available.
|
||||
<sup>2</sup>Additionally, user input can disambiguate when two or more options are available.
|
||||
<br>
|
||||
<sup>3</sup>Available if the <a href="https://atom.io/packages/go-debug">go-debug</a> package is installed.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
@@ -206,5 +229,3 @@ The following feature matrix lists and compares the most significant features.
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--TODO(jbd): Add the Atom comparison-->
|
||||
BIN
doc/editors/go-plus.png
Normal file
BIN
doc/editors/go-plus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -15,12 +15,7 @@ Do not send CLs removing the interior tags from such phrases.
|
||||
ul li { margin: 0.5em 0; }
|
||||
</style>
|
||||
|
||||
<h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.9</h2>
|
||||
|
||||
<p><strong>
|
||||
Go 1.9 is not yet released. These are work-in-progress
|
||||
release notes. Go 1.9 is expected to be released in August 2017.
|
||||
</strong></p>
|
||||
<h2 id="introduction">Introduction to Go 1.9</h2>
|
||||
|
||||
<p>
|
||||
The latest Go release, version 1.9, arrives six months
|
||||
@@ -156,6 +151,21 @@ type T1 = T2
|
||||
directories, write <code>./vendor/...</code>.
|
||||
</p>
|
||||
|
||||
<h3 id="goroot">Moved GOROOT</h3>
|
||||
|
||||
<p><!-- CL 42533 -->
|
||||
The <a href="/cmd/go/">go tool</a> will now use the path from which it
|
||||
was invoked to attempt to locate the root of the Go install tree.
|
||||
This means that if the entire Go installation is moved to a new
|
||||
location, the go tool should continue to work as usual.
|
||||
This may be overridden by setting <code>GOROOT</code> in the environment,
|
||||
which should only be done in unusual circumstances.
|
||||
Note that this does not affect the result of
|
||||
the <a href="/pkg/runtime/#GOROOT">runtime.GOROOT</a> function, which
|
||||
will continue to report the original installation location;
|
||||
this may be fixed in later releases.
|
||||
</p>
|
||||
|
||||
<h3 id="compiler">Compiler Toolchain</h3>
|
||||
|
||||
<p><!-- CL 37441 -->
|
||||
@@ -473,6 +483,15 @@ version of gccgo.
|
||||
populated.
|
||||
</p>
|
||||
|
||||
<p><!-- CL 36696 -->
|
||||
|
||||
If any SAN extension, including with no DNS names, is present
|
||||
in the certificate, then the Common Name from
|
||||
<a href="/pkg/crypto/x509/#Certificate.Subject"><code>Subject</code></a> is ignored.
|
||||
In previous releases, the code tested only whether DNS-name SANs were
|
||||
present in a certificate.
|
||||
</p>
|
||||
|
||||
</dl><!-- crypto/x509 -->
|
||||
|
||||
<dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
|
||||
@@ -728,7 +747,7 @@ version of gccgo.
|
||||
<li><!-- CL 35488 -->
|
||||
The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
|
||||
now supports making requests via SOCKS5 proxy when the URL returned by
|
||||
<a href="/net/http/#Transport.Proxy"><code>Transport.Proxy</code></a>
|
||||
<a href="/pkg/net/http/#Transport.Proxy"><code>Transport.Proxy</code></a>
|
||||
has the scheme <code>socks5</code>.
|
||||
</li>
|
||||
</ul>
|
||||
@@ -764,6 +783,16 @@ version of gccgo.
|
||||
|
||||
</dl><!-- net/http/httptest -->
|
||||
|
||||
<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 43712 -->
|
||||
The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
|
||||
now proxies all HTTP/2 response trailers, even those not declared in the initial response
|
||||
header. Such undeclared trailers are used by the gRPC protocol.
|
||||
</p>
|
||||
|
||||
</dl><!-- net/http/httputil -->
|
||||
|
||||
<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 36800 -->
|
||||
|
||||
@@ -221,7 +221,7 @@ To build without <code>cgo</code>, set the environment variable
|
||||
Change to the directory that will be its parent
|
||||
and make sure the <code>go</code> directory does not exist.
|
||||
Then clone the repository and check out the latest release tag
|
||||
(<code class="versionTag">go1.8.1</code>, for example):</p>
|
||||
(<code class="versionTag">go1.9</code>, for example):</p>
|
||||
|
||||
<pre>
|
||||
$ git clone https://go.googlesource.com/go
|
||||
@@ -409,7 +409,7 @@ New releases are announced on the
|
||||
<a href="//groups.google.com/group/golang-announce">golang-announce</a>
|
||||
mailing list.
|
||||
Each announcement mentions the latest release tag, for instance,
|
||||
<code class="versionTag">go1.8.1</code>.
|
||||
<code class="versionTag">go1.9</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
144
doc/root.html
144
doc/root.html
@@ -6,7 +6,9 @@
|
||||
<div class="left">
|
||||
|
||||
<div id="learn">
|
||||
{{if not $.GoogleCN}}
|
||||
<a class="popout share">Pop-out</a>
|
||||
{{end}}
|
||||
<div class="rootHeading">Try Go</div>
|
||||
<div class="input">
|
||||
<textarea spellcheck="false" class="code">// You can edit this code!
|
||||
@@ -26,10 +28,10 @@ Hello, 世界
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a class="run" href="#" title="Run this code [shift-enter]">Run</a>
|
||||
{{if $.Share}}
|
||||
{{if not $.GoogleCN}}
|
||||
<a class="share" href="#" title="Share this code">Share</a>
|
||||
{{end}}
|
||||
<a class="tour" href="//tour.golang.org/" title="Learn Go from your browser">Tour</a>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="toys">
|
||||
<select>
|
||||
@@ -68,85 +70,91 @@ Linux, Mac OS X, Windows, and more.
|
||||
|
||||
<div style="clear: both"></div>
|
||||
|
||||
{{if not $.GoogleCN}}
|
||||
<div class="left">
|
||||
|
||||
<div id="video">
|
||||
<div class="rootHeading">Featured video</div>
|
||||
<iframe width="415" height="241" src="//www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
|
||||
<div id="video">
|
||||
<div class="rootHeading">Featured video</div>
|
||||
<iframe width="415" height="241" src="//www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
|
||||
<div id="blog">
|
||||
<div class="rootHeading">Featured articles</div>
|
||||
<div class="read"><a href="//blog.golang.org/">Read more</a></div>
|
||||
</div>
|
||||
|
||||
<div id="blog">
|
||||
<div class="rootHeading">Featured articles</div>
|
||||
<div class="read"><a href="//blog.golang.org/">Read more</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function readableTime(t) {
|
||||
var m = ["January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December"];
|
||||
var p = t.substring(0, t.indexOf("T")).split("-");
|
||||
var d = new Date(p[0], p[1]-1, p[2]);
|
||||
return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
|
||||
}
|
||||
window.initFuncs.push(function() {
|
||||
// Set up playground if enabled.
|
||||
if (window.playground) {
|
||||
window.playground({
|
||||
"codeEl": "#learn .code",
|
||||
"outputEl": "#learn .output",
|
||||
"runEl": "#learn .run",
|
||||
"shareEl": "#learn .share",
|
||||
"shareRedirect": "//play.golang.org/p/",
|
||||
"toysEl": "#learn .toys select"
|
||||
});
|
||||
} else {
|
||||
$('#learn').hide()
|
||||
}
|
||||
});
|
||||
|
||||
function feedLoaded(result) {
|
||||
var blog = document.getElementById("blog");
|
||||
var read = blog.getElementsByClassName("read")[0];
|
||||
for (var i = 0; i < result.length && i < 2; i++) {
|
||||
var entry = result[i];
|
||||
var title = document.createElement("a");
|
||||
title.className = "title";
|
||||
title.href = entry.Link;
|
||||
title.innerHTML = entry.Title;
|
||||
blog.insertBefore(title, read);
|
||||
var extract = document.createElement("div");
|
||||
extract.className = "extract";
|
||||
extract.innerHTML = entry.Summary;
|
||||
blog.insertBefore(extract, read);
|
||||
var when = document.createElement("div");
|
||||
when.className = "when";
|
||||
when.innerHTML = "Published " + readableTime(entry.Time);
|
||||
blog.insertBefore(when, read);
|
||||
}
|
||||
}
|
||||
{{if not $.GoogleCN}}
|
||||
|
||||
window.initFuncs.push(function() {
|
||||
// Set up playground if enabled.
|
||||
if (window.playground) {
|
||||
window.playground({
|
||||
"codeEl": "#learn .code",
|
||||
"outputEl": "#learn .output",
|
||||
"runEl": "#learn .run",
|
||||
"shareEl": "#learn .share",
|
||||
"shareRedirect": "//play.golang.org/p/",
|
||||
"toysEl": "#learn .toys select"
|
||||
});
|
||||
} else {
|
||||
$('#learn').hide()
|
||||
function readableTime(t) {
|
||||
var m = ["January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December"];
|
||||
var p = t.substring(0, t.indexOf("T")).split("-");
|
||||
var d = new Date(p[0], p[1]-1, p[2]);
|
||||
return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
|
||||
}
|
||||
|
||||
// Load blog feed.
|
||||
$('<script/>').attr('text', 'text/javascript')
|
||||
.attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
|
||||
.appendTo('body');
|
||||
window.feedLoaded = function(result) {
|
||||
var blog = document.getElementById("blog");
|
||||
var read = blog.getElementsByClassName("read")[0];
|
||||
for (var i = 0; i < result.length && i < 2; i++) {
|
||||
var entry = result[i];
|
||||
var title = document.createElement("a");
|
||||
title.className = "title";
|
||||
title.href = entry.Link;
|
||||
title.innerHTML = entry.Title;
|
||||
blog.insertBefore(title, read);
|
||||
var extract = document.createElement("div");
|
||||
extract.className = "extract";
|
||||
extract.innerHTML = entry.Summary;
|
||||
blog.insertBefore(extract, read);
|
||||
var when = document.createElement("div");
|
||||
when.className = "when";
|
||||
when.innerHTML = "Published " + readableTime(entry.Time);
|
||||
blog.insertBefore(when, read);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the video at random.
|
||||
var videos = [
|
||||
{h: 241, s: "//www.youtube.com/embed/ytEkHepK08c"}, // Tour of Go
|
||||
{h: 241, s: "//www.youtube.com/embed/f6kdp27TYZs"}, // Concurrency Patterns
|
||||
{h: 233, s: "//player.vimeo.com/video/69237265"} // Simple environment
|
||||
];
|
||||
var v = videos[Math.floor(Math.random()*videos.length)];
|
||||
$('#video iframe').attr('height', v.h).attr('src', v.s);
|
||||
});
|
||||
window.initFuncs.push(function() {
|
||||
// Load blog feed.
|
||||
$('<script/>').attr('text', 'text/javascript')
|
||||
.attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
|
||||
.appendTo('body');
|
||||
|
||||
// Set the video at random.
|
||||
var videos = [
|
||||
{h: 241, s: "//www.youtube.com/embed/ytEkHepK08c"}, // Tour of Go
|
||||
{h: 241, s: "//www.youtube.com/embed/f6kdp27TYZs"}, // Concurrency Patterns
|
||||
{h: 233, s: "//player.vimeo.com/video/69237265"} // Simple environment
|
||||
];
|
||||
var v = videos[Math.floor(Math.random()*videos.length)];
|
||||
$('#video iframe').attr('height', v.h).attr('src', v.s);
|
||||
});
|
||||
|
||||
{{end}}
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -343,6 +343,14 @@ var ptrTests = []ptrTest{
|
||||
body: `var b C.char; p := &b; C.f((*C.u)(unsafe.Pointer(&p)))`,
|
||||
fail: false,
|
||||
},
|
||||
{
|
||||
// Issue #21306.
|
||||
name: "preempt-during-call",
|
||||
c: `void f() {}`,
|
||||
imports: []string{"runtime", "sync"},
|
||||
body: `var wg sync.WaitGroup; wg.Add(100); for i := 0; i < 100; i++ { go func(i int) { for j := 0; j < 100; j++ { C.f(); runtime.GOMAXPROCS(i) }; wg.Done() }(i) }; wg.Wait()`,
|
||||
fail: false,
|
||||
},
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -156,15 +156,18 @@ if test "$tsan" = "yes"; then
|
||||
if ! $CC -fsanitize=thread ${TMPDIR}/testsanitizers$$.c -o ${TMPDIR}/testsanitizers$$ &> ${TMPDIR}/testsanitizers$$.err; then
|
||||
ok=no
|
||||
fi
|
||||
if grep "unrecognized" ${TMPDIR}/testsanitizers$$.err >& /dev/null; then
|
||||
if grep "unrecognized" ${TMPDIR}/testsanitizers$$.err >& /dev/null; then
|
||||
echo "skipping tsan tests: -fsanitize=thread not supported"
|
||||
tsan=no
|
||||
elif test "$ok" != "yes"; then
|
||||
cat ${TMPDIR}/testsanitizers$$.err
|
||||
echo "skipping tsan tests: -fsanitizer=thread build failed"
|
||||
tsan=no
|
||||
fi
|
||||
rm -f ${TMPDIR}/testsanitizers$$*
|
||||
elif test "$ok" != "yes"; then
|
||||
cat ${TMPDIR}/testsanitizers$$.err
|
||||
echo "skipping tsan tests: -fsanitizer=thread build failed"
|
||||
tsan=no
|
||||
elif ! ${TMPDIR}/testsanitizers$$ 2>&1; then
|
||||
echo "skipping tsan tests: running tsan program failed"
|
||||
tsan=no
|
||||
fi
|
||||
rm -f ${TMPDIR}/testsanitizers$$*
|
||||
fi
|
||||
|
||||
# Run a TSAN test.
|
||||
@@ -196,8 +199,10 @@ if test "$tsan" = "yes"; then
|
||||
# These tests are only reliable using clang or GCC version 7 or later.
|
||||
# Otherwise runtime/cgo/libcgo.h can't tell whether TSAN is in use.
|
||||
ok=false
|
||||
clang=false
|
||||
if ${CC} --version | grep clang >/dev/null 2>&1; then
|
||||
ok=true
|
||||
clang=true
|
||||
else
|
||||
ver=$($CC -dumpversion)
|
||||
major=$(echo $ver | sed -e 's/\([0-9]*\).*/\1/')
|
||||
@@ -213,9 +218,13 @@ if test "$tsan" = "yes"; then
|
||||
testtsan tsan5.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan6.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan7.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan10.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan11.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan12.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
|
||||
# The remaining tests reportedly hang when built with GCC; issue #21196.
|
||||
if test "$clang" = "true"; then
|
||||
testtsan tsan10.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan11.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
testtsan tsan12.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
|
||||
fi
|
||||
|
||||
testtsanshared
|
||||
fi
|
||||
|
||||
@@ -464,6 +464,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case ssa.OpARMMOVWaddr:
|
||||
p := s.Prog(arm.AMOVW)
|
||||
p.From.Type = obj.TYPE_ADDR
|
||||
p.From.Reg = v.Args[0].Reg()
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = v.Reg()
|
||||
|
||||
@@ -485,7 +486,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case nil:
|
||||
// No sym, just MOVW $off(SP), R
|
||||
wantreg = "SP"
|
||||
p.From.Reg = arm.REGSP
|
||||
p.From.Offset = v.AuxInt
|
||||
}
|
||||
if reg := v.Args[0].RegName(); reg != wantreg {
|
||||
|
||||
@@ -260,6 +260,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case ssa.OpARM64MOVDaddr:
|
||||
p := s.Prog(arm64.AMOVD)
|
||||
p.From.Type = obj.TYPE_ADDR
|
||||
p.From.Reg = v.Args[0].Reg()
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = v.Reg()
|
||||
|
||||
@@ -281,7 +282,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case nil:
|
||||
// No sym, just MOVD $off(SP), R
|
||||
wantreg = "SP"
|
||||
p.From.Reg = arm64.REGSP
|
||||
p.From.Offset = v.AuxInt
|
||||
}
|
||||
if reg := v.Args[0].RegName(); reg != wantreg {
|
||||
|
||||
@@ -898,6 +898,17 @@ var linuxAMD64Tests = []*asmTest{
|
||||
}`,
|
||||
[]string{"\tCMPL\t[A-Z]"},
|
||||
},
|
||||
{
|
||||
// make sure assembly output has matching offset and base register.
|
||||
`
|
||||
func f72(a, b int) int {
|
||||
var x [16]byte // use some frame
|
||||
_ = x
|
||||
return b
|
||||
}
|
||||
`,
|
||||
[]string{"b\\+40\\(SP\\)"},
|
||||
},
|
||||
}
|
||||
|
||||
var linux386Tests = []*asmTest{
|
||||
@@ -1302,6 +1313,17 @@ var linuxARMTests = []*asmTest{
|
||||
`,
|
||||
[]string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
// make sure assembly output has matching offset and base register.
|
||||
`
|
||||
func f13(a, b int) int {
|
||||
var x [16]byte // use some frame
|
||||
_ = x
|
||||
return b
|
||||
}
|
||||
`,
|
||||
[]string{"b\\+4\\(FP\\)"},
|
||||
},
|
||||
}
|
||||
|
||||
var linuxARM64Tests = []*asmTest{
|
||||
@@ -1473,7 +1495,7 @@ var linuxARM64Tests = []*asmTest{
|
||||
return
|
||||
}
|
||||
`,
|
||||
[]string{"\tMOVD\t\"\"\\.a\\+[0-9]+\\(RSP\\), R[0-9]+", "\tMOVD\tR[0-9]+, \"\"\\.b\\+[0-9]+\\(RSP\\)"},
|
||||
[]string{"\tMOVD\t\"\"\\.a\\+[0-9]+\\(FP\\), R[0-9]+", "\tMOVD\tR[0-9]+, \"\"\\.b\\+[0-9]+\\(FP\\)"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -293,4 +293,8 @@ var (
|
||||
typedmemmove,
|
||||
typedmemclr,
|
||||
Udiv *obj.LSym
|
||||
|
||||
// GO386=387
|
||||
ControlWord64trunc,
|
||||
ControlWord32 *obj.LSym
|
||||
)
|
||||
|
||||
@@ -92,6 +92,10 @@ func initssaconfig() {
|
||||
typedmemmove = Sysfunc("typedmemmove")
|
||||
typedmemclr = Sysfunc("typedmemclr")
|
||||
Udiv = Sysfunc("udiv")
|
||||
|
||||
// GO386=387 runtime functions
|
||||
ControlWord64trunc = Sysfunc("controlWord64trunc")
|
||||
ControlWord32 = Sysfunc("controlWord32")
|
||||
}
|
||||
|
||||
// buildssa builds an SSA function for fn.
|
||||
|
||||
680
src/cmd/compile/internal/gc/testdata/arithConst.go
vendored
680
src/cmd/compile/internal/gc/testdata/arithConst.go
vendored
@@ -35,6 +35,16 @@ func add_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 + a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func add_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a + 9223372036854775808
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func add_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 + a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func add_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a + 18446744073709551615
|
||||
@@ -75,6 +85,16 @@ func sub_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 - a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func sub_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a - 9223372036854775808
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func sub_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 - a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func sub_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a - 18446744073709551615
|
||||
@@ -110,6 +130,16 @@ func div_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 / a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func div_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a / 9223372036854775808
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func div_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 / a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func div_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a / 18446744073709551615
|
||||
@@ -150,6 +180,16 @@ func mul_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 * a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func mul_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a * 9223372036854775808
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func mul_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 * a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func mul_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a * 18446744073709551615
|
||||
@@ -190,6 +230,16 @@ func lsh_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 << a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func lsh_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a << uint64(9223372036854775808)
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func lsh_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 << a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a << uint64(18446744073709551615)
|
||||
@@ -230,6 +280,16 @@ func rsh_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 >> a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func rsh_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a >> uint64(9223372036854775808)
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func rsh_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 >> a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a >> uint64(18446744073709551615)
|
||||
@@ -265,6 +325,16 @@ func mod_4294967296_uint64_ssa(a uint64) uint64 {
|
||||
return 4294967296 % a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func mod_uint64_9223372036854775808_ssa(a uint64) uint64 {
|
||||
return a % 9223372036854775808
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func mod_9223372036854775808_uint64_ssa(a uint64) uint64 {
|
||||
return 9223372036854775808 % a
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func mod_uint64_18446744073709551615_ssa(a uint64) uint64 {
|
||||
return a % 18446744073709551615
|
||||
@@ -2319,6 +2389,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_0_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("add_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_0_uint64_ssa(18446744073709551615); got != 18446744073709551615 {
|
||||
fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got)
|
||||
failed = true
|
||||
@@ -2359,6 +2439,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_1_uint64_ssa(9223372036854775808); got != 9223372036854775809 {
|
||||
fmt.Printf("add_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_1_ssa(9223372036854775808); got != 9223372036854775809 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775809\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_1_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got)
|
||||
failed = true
|
||||
@@ -2399,6 +2489,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_4294967296_uint64_ssa(9223372036854775808); got != 9223372041149743104 {
|
||||
fmt.Printf("add_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_4294967296_ssa(9223372036854775808); got != 9223372041149743104 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372041149743104\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_4294967296_uint64_ssa(18446744073709551615); got != 4294967295 {
|
||||
fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got)
|
||||
failed = true
|
||||
@@ -2409,6 +2509,56 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_9223372036854775808_ssa(0); got != 9223372036854775808 {
|
||||
fmt.Printf("add_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_9223372036854775808_uint64_ssa(1); got != 9223372036854775809 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775809\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_9223372036854775808_ssa(1); got != 9223372036854775809 {
|
||||
fmt.Printf("add_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_9223372036854775808_uint64_ssa(4294967296); got != 9223372041149743104 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372041149743104\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_9223372036854775808_ssa(4294967296); got != 9223372041149743104 {
|
||||
fmt.Printf("add_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775807 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775807\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775807 {
|
||||
fmt.Printf("add_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
|
||||
fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got)
|
||||
failed = true
|
||||
@@ -2439,6 +2589,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775807 {
|
||||
fmt.Printf("add_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775807 {
|
||||
fmt.Printf("add_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775807\n", `+`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := add_18446744073709551615_uint64_ssa(18446744073709551615); got != 18446744073709551614 {
|
||||
fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got)
|
||||
failed = true
|
||||
@@ -2479,6 +2639,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_0_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("sub_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_0_uint64_ssa(18446744073709551615); got != 1 {
|
||||
fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got)
|
||||
failed = true
|
||||
@@ -2519,6 +2689,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_1_uint64_ssa(9223372036854775808); got != 9223372036854775809 {
|
||||
fmt.Printf("sub_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_1_ssa(9223372036854775808); got != 9223372036854775807 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775807\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_1_uint64_ssa(18446744073709551615); got != 2 {
|
||||
fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got)
|
||||
failed = true
|
||||
@@ -2559,6 +2739,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_4294967296_uint64_ssa(9223372036854775808); got != 9223372041149743104 {
|
||||
fmt.Printf("sub_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_4294967296_ssa(9223372036854775808); got != 9223372032559808512 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372032559808512\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_4294967296_uint64_ssa(18446744073709551615); got != 4294967297 {
|
||||
fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got)
|
||||
failed = true
|
||||
@@ -2569,6 +2759,56 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_9223372036854775808_ssa(0); got != 9223372036854775808 {
|
||||
fmt.Printf("sub_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_9223372036854775808_uint64_ssa(1); got != 9223372036854775807 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775807\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_9223372036854775808_ssa(1); got != 9223372036854775809 {
|
||||
fmt.Printf("sub_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_9223372036854775808_uint64_ssa(4294967296); got != 9223372032559808512 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372032559808512\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_9223372036854775808_ssa(4294967296); got != 9223372041149743104 {
|
||||
fmt.Printf("sub_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775809 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775809\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775807 {
|
||||
fmt.Printf("sub_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
|
||||
fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got)
|
||||
failed = true
|
||||
@@ -2599,6 +2839,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775807 {
|
||||
fmt.Printf("sub_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775809 {
|
||||
fmt.Printf("sub_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775809\n", `-`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := sub_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got)
|
||||
failed = true
|
||||
@@ -2619,6 +2869,11 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_0_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("div_uint64 0%s9223372036854775808 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_0_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
@@ -2649,6 +2904,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_1_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("div_uint64 1%s9223372036854775808 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_1_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_1_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("div_uint64 1%s18446744073709551615 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
@@ -2684,6 +2949,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_4294967296_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("div_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_4294967296_ssa(9223372036854775808); got != 2147483648 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s4294967296 = %d, wanted 2147483648\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_4294967296_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("div_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
@@ -2694,6 +2969,51 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_9223372036854775808_ssa(0); got != 0 {
|
||||
fmt.Printf("div_uint64 0%s9223372036854775808 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_9223372036854775808_uint64_ssa(1); got != 9223372036854775808 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_9223372036854775808_ssa(1); got != 0 {
|
||||
fmt.Printf("div_uint64 1%s9223372036854775808 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_9223372036854775808_uint64_ssa(4294967296); got != 2147483648 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s4294967296 = %d, wanted 2147483648\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_9223372036854775808_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("div_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_9223372036854775808_uint64_ssa(9223372036854775808); got != 1 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 1\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_9223372036854775808_ssa(9223372036854775808); got != 1 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 1\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_9223372036854775808_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_9223372036854775808_ssa(18446744073709551615); got != 1 {
|
||||
fmt.Printf("div_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 1\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_18446744073709551615_ssa(0); got != 0 {
|
||||
fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
@@ -2719,6 +3039,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_18446744073709551615_uint64_ssa(9223372036854775808); got != 1 {
|
||||
fmt.Printf("div_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 1\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_uint64_18446744073709551615_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("div_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `/`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := div_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 {
|
||||
fmt.Printf("div_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `/`, got)
|
||||
failed = true
|
||||
@@ -2759,6 +3089,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_0_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mul_uint64 0%s9223372036854775808 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_0_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s0 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_0_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("mul_uint64 0%s18446744073709551615 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
@@ -2799,6 +3139,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_1_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_1_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_1_uint64_ssa(18446744073709551615); got != 18446744073709551615 {
|
||||
fmt.Printf("mul_uint64 1%s18446744073709551615 = %d, wanted 18446744073709551615\n", `*`, got)
|
||||
failed = true
|
||||
@@ -2839,6 +3189,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_4294967296_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mul_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_4294967296_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_4294967296_uint64_ssa(18446744073709551615); got != 18446744069414584320 {
|
||||
fmt.Printf("mul_uint64 4294967296%s18446744073709551615 = %d, wanted 18446744069414584320\n", `*`, got)
|
||||
failed = true
|
||||
@@ -2849,6 +3209,56 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_9223372036854775808_uint64_ssa(0); got != 0 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s0 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_9223372036854775808_ssa(0); got != 0 {
|
||||
fmt.Printf("mul_uint64 0%s9223372036854775808 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_9223372036854775808_uint64_ssa(1); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_9223372036854775808_ssa(1); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_9223372036854775808_uint64_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_9223372036854775808_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("mul_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_18446744073709551615_uint64_ssa(0); got != 0 {
|
||||
fmt.Printf("mul_uint64 18446744073709551615%s0 = %d, wanted 0\n", `*`, got)
|
||||
failed = true
|
||||
@@ -2879,6 +3289,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("mul_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `*`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mul_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 {
|
||||
fmt.Printf("mul_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `*`, got)
|
||||
failed = true
|
||||
@@ -2919,6 +3339,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_0_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_0_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("lsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
@@ -2959,6 +3389,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_1_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_1_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s1 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_1_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("lsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
@@ -2999,6 +3439,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_4294967296_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_4294967296_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_4294967296_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("lsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
@@ -3009,6 +3459,56 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_9223372036854775808_ssa(0); got != 0 {
|
||||
fmt.Printf("lsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_9223372036854775808_uint64_ssa(1); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s1 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_9223372036854775808_ssa(1); got != 0 {
|
||||
fmt.Printf("lsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_9223372036854775808_uint64_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_9223372036854775808_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("lsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_9223372036854775808_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_9223372036854775808_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("lsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
|
||||
fmt.Printf("lsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `<<`, got)
|
||||
failed = true
|
||||
@@ -3039,6 +3539,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_18446744073709551615_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_uint64_18446744073709551615_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("lsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := lsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("lsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
|
||||
failed = true
|
||||
@@ -3079,6 +3589,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_0_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_0_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("rsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
@@ -3119,6 +3639,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_1_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_1_ssa(9223372036854775808); got != 4611686018427387904 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s1 = %d, wanted 4611686018427387904\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_1_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("rsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
@@ -3159,6 +3689,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_4294967296_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_4294967296_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_4294967296_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("rsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
@@ -3169,6 +3709,56 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_9223372036854775808_ssa(0); got != 0 {
|
||||
fmt.Printf("rsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_9223372036854775808_uint64_ssa(1); got != 4611686018427387904 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s1 = %d, wanted 4611686018427387904\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_9223372036854775808_ssa(1); got != 0 {
|
||||
fmt.Printf("rsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_9223372036854775808_uint64_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_9223372036854775808_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("rsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_9223372036854775808_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_9223372036854775808_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("rsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
|
||||
fmt.Printf("rsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `>>`, got)
|
||||
failed = true
|
||||
@@ -3199,6 +3789,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_18446744073709551615_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_uint64_18446744073709551615_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("rsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := rsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("rsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
|
||||
failed = true
|
||||
@@ -3219,6 +3819,11 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_0_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mod_uint64 0%s9223372036854775808 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_0_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
@@ -3249,6 +3854,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_1_uint64_ssa(9223372036854775808); got != 1 {
|
||||
fmt.Printf("mod_uint64 1%s9223372036854775808 = %d, wanted 1\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_1_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s1 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_1_uint64_ssa(18446744073709551615); got != 1 {
|
||||
fmt.Printf("mod_uint64 1%s18446744073709551615 = %d, wanted 1\n", `%`, got)
|
||||
failed = true
|
||||
@@ -3284,6 +3899,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_4294967296_uint64_ssa(9223372036854775808); got != 4294967296 {
|
||||
fmt.Printf("mod_uint64 4294967296%s9223372036854775808 = %d, wanted 4294967296\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_4294967296_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_4294967296_uint64_ssa(18446744073709551615); got != 4294967296 {
|
||||
fmt.Printf("mod_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967296\n", `%`, got)
|
||||
failed = true
|
||||
@@ -3294,6 +3919,51 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_9223372036854775808_ssa(0); got != 0 {
|
||||
fmt.Printf("mod_uint64 0%s9223372036854775808 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_9223372036854775808_uint64_ssa(1); got != 0 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s1 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_9223372036854775808_ssa(1); got != 1 {
|
||||
fmt.Printf("mod_uint64 1%s9223372036854775808 = %d, wanted 1\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_9223372036854775808_uint64_ssa(4294967296); got != 0 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_9223372036854775808_ssa(4294967296); got != 4294967296 {
|
||||
fmt.Printf("mod_uint64 4294967296%s9223372036854775808 = %d, wanted 4294967296\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775808 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775807 {
|
||||
fmt.Printf("mod_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_18446744073709551615_ssa(0); got != 0 {
|
||||
fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
@@ -3319,6 +3989,16 @@ func main() {
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775807 {
|
||||
fmt.Printf("mod_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775808 {
|
||||
fmt.Printf("mod_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `%`, got)
|
||||
failed = true
|
||||
}
|
||||
|
||||
if got := mod_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
|
||||
fmt.Printf("mod_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `%`, got)
|
||||
failed = true
|
||||
|
||||
@@ -31,7 +31,7 @@ type szD struct {
|
||||
}
|
||||
|
||||
var szs = []szD{
|
||||
{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}},
|
||||
{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0x8000000000000000, 0xffffFFFFffffFFFF}},
|
||||
{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
|
||||
-4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}},
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case ssa.OpMIPSMOVWaddr:
|
||||
p := s.Prog(mips.AMOVW)
|
||||
p.From.Type = obj.TYPE_ADDR
|
||||
p.From.Reg = v.Args[0].Reg()
|
||||
var wantreg string
|
||||
// MOVW $sym+off(base), R
|
||||
// the assembler expands it as the following:
|
||||
@@ -291,7 +292,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case nil:
|
||||
// No sym, just MOVW $off(SP), R
|
||||
wantreg = "SP"
|
||||
p.From.Reg = mips.REGSP
|
||||
p.From.Offset = v.AuxInt
|
||||
}
|
||||
if reg := v.Args[0].RegName(); reg != wantreg {
|
||||
|
||||
@@ -247,6 +247,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case ssa.OpMIPS64MOVVaddr:
|
||||
p := s.Prog(mips.AMOVV)
|
||||
p.From.Type = obj.TYPE_ADDR
|
||||
p.From.Reg = v.Args[0].Reg()
|
||||
var wantreg string
|
||||
// MOVV $sym+off(base), R
|
||||
// the assembler expands it as the following:
|
||||
@@ -265,7 +266,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case nil:
|
||||
// No sym, just MOVV $off(SP), R
|
||||
wantreg = "SP"
|
||||
p.From.Reg = mips.REGSP
|
||||
p.From.Offset = v.AuxInt
|
||||
}
|
||||
if reg := v.Args[0].RegName(); reg != wantreg {
|
||||
|
||||
@@ -638,6 +638,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case ssa.OpPPC64MOVDaddr:
|
||||
p := s.Prog(ppc64.AMOVD)
|
||||
p.From.Type = obj.TYPE_ADDR
|
||||
p.From.Reg = v.Args[0].Reg()
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = v.Reg()
|
||||
|
||||
@@ -660,7 +661,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
case nil:
|
||||
// No sym, just MOVD $off(SP), R
|
||||
wantreg = "SP"
|
||||
p.From.Reg = ppc64.REGSP
|
||||
p.From.Offset = v.AuxInt
|
||||
}
|
||||
if reg := v.Args[0].RegName(); reg != wantreg {
|
||||
|
||||
@@ -945,6 +945,7 @@
|
||||
(Div16u n (Const16 [c])) && isPowerOfTwo(c&0xffff) -> (Rsh16Ux64 n (Const64 <typ.UInt64> [log2(c&0xffff)]))
|
||||
(Div32u n (Const32 [c])) && isPowerOfTwo(c&0xffffffff) -> (Rsh32Ux64 n (Const64 <typ.UInt64> [log2(c&0xffffffff)]))
|
||||
(Div64u n (Const64 [c])) && isPowerOfTwo(c) -> (Rsh64Ux64 n (Const64 <typ.UInt64> [log2(c)]))
|
||||
(Div64u n (Const64 [-1<<63])) -> (Rsh64Ux64 n (Const64 <typ.UInt64> [63]))
|
||||
|
||||
// Unsigned divide, not a power of 2. Strength reduce to a multiply.
|
||||
// For 8-bit divides, we just do a direct 9-bit by 8-bit multiply.
|
||||
@@ -1177,6 +1178,7 @@
|
||||
(Mod16u <t> n (Const16 [c])) && isPowerOfTwo(c&0xffff) -> (And16 n (Const16 <t> [(c&0xffff)-1]))
|
||||
(Mod32u <t> n (Const32 [c])) && isPowerOfTwo(c&0xffffffff) -> (And32 n (Const32 <t> [(c&0xffffffff)-1]))
|
||||
(Mod64u <t> n (Const64 [c])) && isPowerOfTwo(c) -> (And64 n (Const64 <t> [c-1]))
|
||||
(Mod64u <t> n (Const64 [-1<<63])) -> (And64 n (Const64 <t> [1<<63-1]))
|
||||
|
||||
// Signed mod by negative constant.
|
||||
(Mod8 <t> n (Const8 [c])) && c < 0 && c != -1<<7 -> (Mod8 <t> n (Const8 <t> [-c]))
|
||||
|
||||
@@ -7240,6 +7240,26 @@ func rewriteValuegeneric_OpDiv64u_0(v *Value) bool {
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
// match: (Div64u n (Const64 [-1<<63]))
|
||||
// cond:
|
||||
// result: (Rsh64Ux64 n (Const64 <typ.UInt64> [63]))
|
||||
for {
|
||||
_ = v.Args[1]
|
||||
n := v.Args[0]
|
||||
v_1 := v.Args[1]
|
||||
if v_1.Op != OpConst64 {
|
||||
break
|
||||
}
|
||||
if v_1.AuxInt != -1<<63 {
|
||||
break
|
||||
}
|
||||
v.reset(OpRsh64Ux64)
|
||||
v.AddArg(n)
|
||||
v0 := b.NewValue0(v.Pos, OpConst64, typ.UInt64)
|
||||
v0.AuxInt = 63
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
// match: (Div64u x (Const64 [c]))
|
||||
// cond: umagicOK(64, c) && config.RegSize == 8 && umagic(64,c).m&1 == 0
|
||||
// result: (Rsh64Ux64 <typ.UInt64> (Hmul64u <typ.UInt64> (Const64 <typ.UInt64> [int64(1<<63+umagic(64,c).m/2)]) x) (Const64 <typ.UInt64> [umagic(64,c).s-1]))
|
||||
@@ -12061,6 +12081,27 @@ func rewriteValuegeneric_OpMod64u_0(v *Value) bool {
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
// match: (Mod64u <t> n (Const64 [-1<<63]))
|
||||
// cond:
|
||||
// result: (And64 n (Const64 <t> [1<<63-1]))
|
||||
for {
|
||||
t := v.Type
|
||||
_ = v.Args[1]
|
||||
n := v.Args[0]
|
||||
v_1 := v.Args[1]
|
||||
if v_1.Op != OpConst64 {
|
||||
break
|
||||
}
|
||||
if v_1.AuxInt != -1<<63 {
|
||||
break
|
||||
}
|
||||
v.reset(OpAnd64)
|
||||
v.AddArg(n)
|
||||
v0 := b.NewValue0(v.Pos, OpConst64, t)
|
||||
v0.AuxInt = 1<<63 - 1
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
// match: (Mod64u <t> x (Const64 [c]))
|
||||
// cond: x.Op != OpConst64 && c > 0 && umagicOK(64,c)
|
||||
// result: (Sub64 x (Mul64 <t> (Div64u <t> x (Const64 <t> [c])) (Const64 <t> [c])))
|
||||
|
||||
@@ -120,7 +120,7 @@ func ssaGenValue387(s *gc.SSAGenState, v *ssa.Value) {
|
||||
p = s.Prog(x86.AFLDCW)
|
||||
p.From.Type = obj.TYPE_MEM
|
||||
p.From.Name = obj.NAME_EXTERN
|
||||
p.From.Sym = gc.Sysfunc("controlWord32")
|
||||
p.From.Sym = gc.ControlWord32
|
||||
}
|
||||
|
||||
var op obj.As
|
||||
@@ -210,7 +210,7 @@ func ssaGenValue387(s *gc.SSAGenState, v *ssa.Value) {
|
||||
p = s.Prog(x86.AFLDCW)
|
||||
p.From.Type = obj.TYPE_MEM
|
||||
p.From.Name = obj.NAME_EXTERN
|
||||
p.From.Sym = gc.Sysfunc("controlWord64trunc")
|
||||
p.From.Sym = gc.ControlWord64trunc
|
||||
|
||||
// Now do the conversion.
|
||||
p = s.Prog(x86.AFMOVLP)
|
||||
|
||||
18
src/cmd/dist/deps.go
vendored
18
src/cmd/dist/deps.go
vendored
@@ -31,8 +31,8 @@ var builddeps = map[string][]string{
|
||||
"cmd/internal/objabi": {"errors", "flag", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "log", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"compress/flate": {"bufio", "bytes", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "math/bits", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"compress/zlib": {"bufio", "bytes", "compress/flate", "errors", "fmt", "hash", "hash/adler32", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "math/bits", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"container/heap": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"context": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
|
||||
"container/heap": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"context": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"crypto": {"errors", "hash", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"crypto/sha1": {"crypto", "errors", "hash", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"debug/dwarf": {"encoding/binary", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
@@ -40,18 +40,18 @@ var builddeps = map[string][]string{
|
||||
"debug/macho": {"bytes", "debug/dwarf", "encoding/binary", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"encoding": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
|
||||
"encoding/base64": {"errors", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"encoding/binary": {"errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"encoding/binary": {"errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"encoding/json": {"bytes", "encoding", "encoding/base64", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"encoding/xml": {"bufio", "bytes", "encoding", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"errors": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
|
||||
"flag": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
|
||||
"fmt": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
|
||||
"flag": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"fmt": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"go/ast": {"bytes", "errors", "fmt", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"go/build": {"bufio", "bytes", "errors", "fmt", "go/ast", "go/doc", "go/parser", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "log", "math", "net/url", "os", "path", "path/filepath", "reflect", "regexp", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "text/template", "text/template/parse", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"go/doc": {"bytes", "errors", "fmt", "go/ast", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "math", "net/url", "os", "path", "path/filepath", "reflect", "regexp", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "text/template", "text/template/parse", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"go/parser": {"bytes", "errors", "fmt", "go/ast", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"go/scanner": {"bytes", "errors", "fmt", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"go/token": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
|
||||
"go/token": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"hash": {"errors", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"},
|
||||
"hash/adler32": {"errors", "hash", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"},
|
||||
"internal/cpu": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
|
||||
@@ -63,7 +63,7 @@ var builddeps = map[string][]string{
|
||||
"internal/syscall/windows/sysdll": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
|
||||
"io": {"errors", "internal/race", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"},
|
||||
"io/ioutil": {"bytes", "errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"log": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
|
||||
"log": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"math": {"internal/cpu", "runtime", "runtime/internal/atomic", "runtime/internal/sys"},
|
||||
"math/bits": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
|
||||
"net/url": {"bytes", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
@@ -72,13 +72,13 @@ var builddeps = map[string][]string{
|
||||
"os/signal": {"errors", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "os", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
|
||||
"path": {"errors", "internal/cpu", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"path/filepath": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
|
||||
"reflect": {"errors", "internal/cpu", "internal/race", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"reflect": {"errors", "internal/cpu", "internal/race", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"regexp": {"bytes", "errors", "internal/cpu", "internal/race", "io", "math", "reflect", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"regexp/syntax": {"bytes", "errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"runtime": {"runtime/internal/atomic", "runtime/internal/sys"},
|
||||
"runtime/internal/atomic": {"runtime/internal/sys"},
|
||||
"runtime/internal/sys": {},
|
||||
"sort": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
|
||||
"sort": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"strconv": {"errors", "internal/cpu", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "unicode/utf8"},
|
||||
"strings": {"errors", "internal/cpu", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic", "unicode", "unicode/utf8"},
|
||||
"sync": {"internal/race", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync/atomic"},
|
||||
|
||||
11
src/cmd/dist/test.go
vendored
11
src/cmd/dist/test.go
vendored
@@ -447,6 +447,17 @@ func (t *tester) registerTests() {
|
||||
t.runPending(dt)
|
||||
moved := t.goroot + "-moved"
|
||||
if err := os.Rename(t.goroot, moved); err != nil {
|
||||
if t.goos == "windows" {
|
||||
// Fails on Windows (with "Access is denied") if a process
|
||||
// or binary is in this directory. For instance, using all.bat
|
||||
// when run from c:\workdir\go\src fails here
|
||||
// if GO_BUILDER_NAME is set. Our builders invoke tests
|
||||
// a different way which happens to work when sharding
|
||||
// tests, but we should be tolerant of the non-sharded
|
||||
// all.bat case.
|
||||
log.Printf("skipping test on Windows")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -4314,3 +4314,20 @@ func TestTestRegexps(t *testing.T) {
|
||||
t.Errorf("reduced output:<<<\n%s>>> want:<<<\n%s>>>", have, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListTests(t *testing.T) {
|
||||
var tg *testgoData
|
||||
testWith := func(listName, expected string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
tg = testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.run("test", "./testdata/src/testlist/...", fmt.Sprintf("-list=%s", listName))
|
||||
tg.grepStdout(expected, fmt.Sprintf("-test.list=%s returned %q, expected %s", listName, tg.getStdout(), expected))
|
||||
}
|
||||
}
|
||||
|
||||
t.Run("Test", testWith("Test", "TestSimple"))
|
||||
t.Run("Bench", testWith("Benchmark", "BenchmarkSimple"))
|
||||
t.Run("Example1", testWith("Example", "ExampleSimple"))
|
||||
t.Run("Example2", testWith("Example", "ExampleWithEmptyOutput"))
|
||||
}
|
||||
|
||||
14
src/cmd/go/testdata/src/testlist/bench_test.go
vendored
Normal file
14
src/cmd/go/testdata/src/testlist/bench_test.go
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
package testlist
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func BenchmarkSimplefunc(b *testing.B) {
|
||||
b.StopTimer()
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = fmt.Sprint("Test for bench")
|
||||
}
|
||||
}
|
||||
21
src/cmd/go/testdata/src/testlist/example_test.go
vendored
Normal file
21
src/cmd/go/testdata/src/testlist/example_test.go
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package testlist
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func ExampleSimple() {
|
||||
fmt.Println("Test with Output.")
|
||||
|
||||
// Output: Test with Output.
|
||||
}
|
||||
|
||||
func ExampleWithEmptyOutput() {
|
||||
fmt.Println("")
|
||||
|
||||
// Output:
|
||||
}
|
||||
|
||||
func ExampleNoOutput() {
|
||||
_ = fmt.Sprint("Test with no output")
|
||||
}
|
||||
10
src/cmd/go/testdata/src/testlist/test_test.go
vendored
Normal file
10
src/cmd/go/testdata/src/testlist/test_test.go
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
package testlist
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSimple(t *testing.T) {
|
||||
_ = fmt.Sprint("Test simple")
|
||||
}
|
||||
@@ -1167,6 +1167,11 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
|
||||
return C_ADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = c.autosize + a.Offset
|
||||
if t := immaddr(int32(c.instoffset)); t != 0 {
|
||||
if immhalf(int32(c.instoffset)) {
|
||||
@@ -1185,6 +1190,11 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
|
||||
return C_LAUTO
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = c.autosize + a.Offset + 4
|
||||
if t := immaddr(int32(c.instoffset)); t != 0 {
|
||||
if immhalf(int32(c.instoffset)) {
|
||||
@@ -1285,10 +1295,20 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
|
||||
return C_LCONADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = c.autosize + a.Offset
|
||||
return c.aconsize()
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = c.autosize + a.Offset + 4
|
||||
return c.aconsize()
|
||||
}
|
||||
|
||||
@@ -1149,10 +1149,20 @@ func (c *ctxt7) aclass(a *obj.Addr) int {
|
||||
return C_GOTADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
return autoclass(c.instoffset)
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + 8
|
||||
return autoclass(c.instoffset)
|
||||
|
||||
@@ -1228,10 +1238,20 @@ func (c *ctxt7) aclass(a *obj.Addr) int {
|
||||
return C_VCONADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
goto aconsize
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + 8
|
||||
goto aconsize
|
||||
}
|
||||
|
||||
@@ -556,6 +556,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
|
||||
return C_LEXT
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SAUTO
|
||||
@@ -563,6 +568,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
|
||||
return C_LAUTO
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SAUTO
|
||||
@@ -616,6 +626,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
|
||||
return C_LECON
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SACON
|
||||
@@ -623,6 +638,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
|
||||
return C_LACON
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SACON
|
||||
|
||||
@@ -758,6 +758,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
|
||||
return C_GOTADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SAUTO
|
||||
@@ -765,6 +770,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
|
||||
return C_LAUTO
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SAUTO
|
||||
@@ -817,6 +827,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
|
||||
return C_LCON
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SACON
|
||||
@@ -824,6 +839,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
|
||||
return C_LACON
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SACON
|
||||
|
||||
@@ -505,6 +505,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
|
||||
return C_GOTADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SAUTO
|
||||
@@ -512,6 +517,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
|
||||
return C_LAUTO
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SAUTO
|
||||
@@ -567,6 +577,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
|
||||
return C_SYMADDR
|
||||
|
||||
case obj.NAME_AUTO:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-SP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SACON
|
||||
@@ -574,6 +589,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
|
||||
return C_LACON
|
||||
|
||||
case obj.NAME_PARAM:
|
||||
if a.Reg == REGSP {
|
||||
// unset base register for better printing, since
|
||||
// a.Offset is still relative to pseudo-FP.
|
||||
a.Reg = obj.REG_NONE
|
||||
}
|
||||
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
|
||||
if c.instoffset >= -BIG && c.instoffset < BIG {
|
||||
return C_SACON
|
||||
|
||||
@@ -349,8 +349,9 @@ func doPackage(directory string, names []string, basePkg *Package) *Package {
|
||||
pkg.files = files
|
||||
// Type check the package.
|
||||
err := pkg.check(fs, astFiles)
|
||||
if err != nil && *verbose {
|
||||
warnf("%s", err)
|
||||
if err != nil {
|
||||
// Note that we only report this error when *verbose.
|
||||
Println(err)
|
||||
}
|
||||
|
||||
// Check.
|
||||
|
||||
13
src/cmd/vet/testdata/cgo/cgo3.go
vendored
Normal file
13
src/cmd/vet/testdata/cgo/cgo3.go
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// 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.
|
||||
|
||||
// Used by TestVetVerbose to test that vet -v doesn't fail because it
|
||||
// can't find "C".
|
||||
|
||||
package testdata
|
||||
|
||||
import "C"
|
||||
|
||||
func F() {
|
||||
}
|
||||
@@ -205,3 +205,15 @@ func TestTags(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #21188.
|
||||
func TestVetVerbose(t *testing.T) {
|
||||
t.Parallel()
|
||||
Build(t)
|
||||
cmd := exec.Command("./"+binary, "-v", "-all", "testdata/cgo/cgo3.go")
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Logf("%s", out)
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,3 +68,94 @@ func ExampleByteOrder_get() {
|
||||
// Output:
|
||||
// 0x03e8 0x07d0
|
||||
}
|
||||
|
||||
func ExamplePutUvarint() {
|
||||
buf := make([]byte, binary.MaxVarintLen64)
|
||||
|
||||
for _, x := range []uint64{1, 2, 127, 128, 255, 256} {
|
||||
n := binary.PutUvarint(buf, x)
|
||||
fmt.Printf("%x\n", buf[:n])
|
||||
}
|
||||
// Output:
|
||||
// 01
|
||||
// 02
|
||||
// 7f
|
||||
// 8001
|
||||
// ff01
|
||||
// 8002
|
||||
}
|
||||
|
||||
func ExamplePutVarint() {
|
||||
buf := make([]byte, binary.MaxVarintLen64)
|
||||
|
||||
for _, x := range []int64{-65, -64, -2, -1, 0, 1, 2, 63, 64} {
|
||||
n := binary.PutVarint(buf, x)
|
||||
fmt.Printf("%x\n", buf[:n])
|
||||
}
|
||||
// Output:
|
||||
// 8101
|
||||
// 7f
|
||||
// 03
|
||||
// 01
|
||||
// 00
|
||||
// 02
|
||||
// 04
|
||||
// 7e
|
||||
// 8001
|
||||
}
|
||||
|
||||
func ExampleUvarint() {
|
||||
inputs := [][]byte{
|
||||
[]byte{0x01},
|
||||
[]byte{0x02},
|
||||
[]byte{0x7f},
|
||||
[]byte{0x80, 0x01},
|
||||
[]byte{0xff, 0x01},
|
||||
[]byte{0x80, 0x02},
|
||||
}
|
||||
for _, b := range inputs {
|
||||
x, n := binary.Uvarint(b)
|
||||
if n != len(b) {
|
||||
fmt.Println("Uvarint did not consume all of in")
|
||||
}
|
||||
fmt.Println(x)
|
||||
}
|
||||
// Output:
|
||||
// 1
|
||||
// 2
|
||||
// 127
|
||||
// 128
|
||||
// 255
|
||||
// 256
|
||||
}
|
||||
|
||||
func ExampleVarint() {
|
||||
inputs := [][]byte{
|
||||
[]byte{0x81, 0x01},
|
||||
[]byte{0x7f},
|
||||
[]byte{0x03},
|
||||
[]byte{0x01},
|
||||
[]byte{0x00},
|
||||
[]byte{0x02},
|
||||
[]byte{0x04},
|
||||
[]byte{0x7e},
|
||||
[]byte{0x80, 0x01},
|
||||
}
|
||||
for _, b := range inputs {
|
||||
x, n := binary.Varint(b)
|
||||
if n != len(b) {
|
||||
fmt.Println("Varint did not consume all of in")
|
||||
}
|
||||
fmt.Println(x)
|
||||
}
|
||||
// Output:
|
||||
// -65
|
||||
// -64
|
||||
// -2
|
||||
// -1
|
||||
// 0
|
||||
// 1
|
||||
// 2
|
||||
// 63
|
||||
// 64
|
||||
}
|
||||
|
||||
@@ -969,14 +969,14 @@ func (*FuncDecl) declNode() {}
|
||||
//
|
||||
// For correct printing of source code containing comments (using packages
|
||||
// go/format and go/printer), special care must be taken to update comments
|
||||
// when a File's syntax tree is modified: For printing, comments are inter-
|
||||
// spersed between tokens based on their position. If syntax tree nodes are
|
||||
// when a File's syntax tree is modified: For printing, comments are interspersed
|
||||
// between tokens based on their position. If syntax tree nodes are
|
||||
// removed or moved, relevant comments in their vicinity must also be removed
|
||||
// (from the File.Comments list) or moved accordingly (by updating their
|
||||
// positions). A CommentMap may be used to facilitate some of these operations.
|
||||
//
|
||||
// Whether and how a comment is associated with a node depends on the inter-
|
||||
// pretation of the syntax tree by the manipulating program: Except for Doc
|
||||
// Whether and how a comment is associated with a node depends on the
|
||||
// interpretation of the syntax tree by the manipulating program: Except for Doc
|
||||
// and Comment comments directly associated with nodes, the remaining comments
|
||||
// are "free-floating" (see also issues #18593, #20744).
|
||||
//
|
||||
|
||||
@@ -1707,8 +1707,8 @@ func (p *parser) parseSimpleStmt(mode int) (ast.Stmt, bool) {
|
||||
}
|
||||
// The label declaration typically starts at x[0].Pos(), but the label
|
||||
// declaration may be erroneous due to a token after that position (and
|
||||
// before the ':'). If SpuriousErrors is not set, the (only) error re-
|
||||
// ported for the line is the illegal label error instead of the token
|
||||
// before the ':'). If SpuriousErrors is not set, the (only) error
|
||||
// reported for the line is the illegal label error instead of the token
|
||||
// before the ':' that caused the problem. Thus, use the (latest) colon
|
||||
// position for error reporting.
|
||||
p.error(colon, "illegal label declaration")
|
||||
|
||||
@@ -154,6 +154,10 @@ func (s *ioSrv) ProcessRemoteIO() {
|
||||
// is available. Alternatively, it passes the request onto
|
||||
// runtime netpoll and waits for completion or cancels request.
|
||||
func (s *ioSrv) ExecIO(o *operation, submit func(o *operation) error) (int, error) {
|
||||
if o.fd.pd.runtimeCtx == 0 {
|
||||
return 0, errors.New("internal error: polling on unsupported descriptor type")
|
||||
}
|
||||
|
||||
if !canCancelIO {
|
||||
onceStartServer.Do(startServer)
|
||||
}
|
||||
@@ -315,8 +319,21 @@ func (fd *FD) Init(net string) (string, error) {
|
||||
return "", errors.New("internal error: unknown network type " + net)
|
||||
}
|
||||
|
||||
if err := fd.pd.init(fd); err != nil {
|
||||
return "", err
|
||||
if !fd.isFile && !fd.isConsole && !fd.isDir {
|
||||
// Only call init for a network socket.
|
||||
// This means that we don't add files to the runtime poller.
|
||||
// Adding files to the runtime poller can confuse matters
|
||||
// if the user is doing their own overlapped I/O.
|
||||
// See issue #21172.
|
||||
//
|
||||
// In general the code below avoids calling the ExecIO
|
||||
// method for non-network sockets. If some method does
|
||||
// somehow call ExecIO, then ExecIO, and therefore the
|
||||
// calling method, will return an error, because
|
||||
// fd.pd.runtimeCtx will be 0.
|
||||
if err := fd.pd.init(fd); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
if hasLoadSetFileCompletionNotificationModes {
|
||||
// We do not use events, so we can skip them always.
|
||||
|
||||
@@ -40,8 +40,8 @@ func (z *Rat) Scan(s fmt.ScanState, ch rune) error {
|
||||
// SetString sets z to the value of s and returns z and a boolean indicating
|
||||
// success. s can be given as a fraction "a/b" or as a floating-point number
|
||||
// optionally followed by an exponent. The entire string (not just a prefix)
|
||||
// must be valid for success. If the operation failed, the value of z is un-
|
||||
// defined but the returned value is nil.
|
||||
// must be valid for success. If the operation failed, the value of z is
|
||||
// undefined but the returned value is nil.
|
||||
func (z *Rat) SetString(s string) (*Rat, bool) {
|
||||
if len(s) == 0 {
|
||||
return nil, false
|
||||
|
||||
@@ -36,3 +36,43 @@ func ExampleLeadingZeros64() {
|
||||
// 64
|
||||
// 63
|
||||
}
|
||||
|
||||
func ExampleOnesCount() {
|
||||
fmt.Printf("%b\n", 14)
|
||||
fmt.Println(bits.OnesCount(14))
|
||||
// Output:
|
||||
// 1110
|
||||
// 3
|
||||
}
|
||||
|
||||
func ExampleOnesCount8() {
|
||||
fmt.Printf("%b\n", 14)
|
||||
fmt.Println(bits.OnesCount8(14))
|
||||
// Output:
|
||||
// 1110
|
||||
// 3
|
||||
}
|
||||
|
||||
func ExampleOnesCount16() {
|
||||
fmt.Printf("%b\n", 14)
|
||||
fmt.Println(bits.OnesCount16(14))
|
||||
// Output:
|
||||
// 1110
|
||||
// 3
|
||||
}
|
||||
|
||||
func ExampleOnesCount32() {
|
||||
fmt.Printf("%b\n", 14)
|
||||
fmt.Println(bits.OnesCount32(14))
|
||||
// Output:
|
||||
// 1110
|
||||
// 3
|
||||
}
|
||||
|
||||
func ExampleOnesCount64() {
|
||||
fmt.Printf("%b\n", 14)
|
||||
fmt.Println(bits.OnesCount64(14))
|
||||
// Output:
|
||||
// 1110
|
||||
// 3
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
// Package plugin implements loading and symbol resolution of Go plugins.
|
||||
//
|
||||
// Currently plugins only work on Linux.
|
||||
//
|
||||
// A plugin is a Go main package with exported functions and variables that
|
||||
// has been built with:
|
||||
//
|
||||
@@ -14,6 +12,9 @@
|
||||
// When a plugin is first opened, the init functions of all packages not
|
||||
// already part of the program are called. The main function is not run.
|
||||
// A plugin is only initialized once, and cannot be closed.
|
||||
//
|
||||
// The plugin support is currently incomplete, only supports Linux,
|
||||
// and has known bugs. Please report any issues.
|
||||
package plugin
|
||||
|
||||
// Plugin is a loaded Go plugin.
|
||||
|
||||
@@ -178,6 +178,12 @@ func deepValueEqual(v1, v2 Value, visited map[visit]bool, depth int) bool {
|
||||
// DeepEqual has been defined so that the same short-cut applies
|
||||
// to slices and maps: if x and y are the same slice or the same map,
|
||||
// they are deeply equal regardless of content.
|
||||
//
|
||||
// As DeepEqual traverses the data values it may find a cycle. The
|
||||
// second and subsequent times that DeepEqual compares two pointer
|
||||
// values that have been compared before, it treats the values as
|
||||
// equal rather than examining the values to which they point.
|
||||
// This ensures that DeepEqual terminates.
|
||||
func DeepEqual(x, y interface{}) bool {
|
||||
if x == nil || y == nil {
|
||||
return x == y
|
||||
|
||||
@@ -163,6 +163,15 @@ func (p *cpuProfile) addExtra() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *cpuProfile) addLostAtomic64(count uint64) {
|
||||
hdr := [1]uint64{count}
|
||||
lostStk := [2]uintptr{
|
||||
funcPC(_LostSIGPROFDuringAtomic64) + sys.PCQuantum,
|
||||
funcPC(_System) + sys.PCQuantum,
|
||||
}
|
||||
cpuprof.log.write(nil, 0, hdr[:], lostStk[:])
|
||||
}
|
||||
|
||||
// CPUProfile panics.
|
||||
// It formerly provided raw access to chunks of
|
||||
// a pprof-format profile generated by the runtime.
|
||||
|
||||
@@ -495,7 +495,7 @@ again:
|
||||
}
|
||||
|
||||
// store new key/value at insert position
|
||||
*((*uint32)(insertk)) = key
|
||||
typedmemmove(t.key, insertk, unsafe.Pointer(&key))
|
||||
*inserti = top
|
||||
h.count++
|
||||
|
||||
@@ -583,7 +583,7 @@ again:
|
||||
}
|
||||
|
||||
// store new key/value at insert position
|
||||
*((*uint64)(insertk)) = key
|
||||
typedmemmove(t.key, insertk, unsafe.Pointer(&key))
|
||||
*inserti = top
|
||||
h.count++
|
||||
|
||||
@@ -723,7 +723,7 @@ func mapdelete_fast32(t *maptype, h *hmap, key uint32) {
|
||||
if key != *k {
|
||||
continue
|
||||
}
|
||||
*k = 0
|
||||
typedmemclr(t.key, unsafe.Pointer(k))
|
||||
v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*4 + i*uintptr(t.valuesize))
|
||||
typedmemclr(t.elem, v)
|
||||
b.tophash[i] = empty
|
||||
@@ -778,7 +778,7 @@ func mapdelete_fast64(t *maptype, h *hmap, key uint64) {
|
||||
if key != *k {
|
||||
continue
|
||||
}
|
||||
*k = 0
|
||||
typedmemclr(t.key, unsafe.Pointer(k))
|
||||
v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*8 + i*uintptr(t.valuesize))
|
||||
typedmemclr(t.elem, v)
|
||||
b.tophash[i] = empty
|
||||
|
||||
@@ -416,7 +416,10 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
|
||||
var reserved bool
|
||||
p := uintptr(sysReserve(unsafe.Pointer(h.arena_end), p_size, &reserved))
|
||||
if p == 0 {
|
||||
return nil
|
||||
// TODO: Try smaller reservation
|
||||
// growths in case we're in a crowded
|
||||
// 32-bit address space.
|
||||
goto reservationFailed
|
||||
}
|
||||
// p can be just about anywhere in the address
|
||||
// space, including before arena_end.
|
||||
@@ -476,6 +479,7 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
|
||||
return unsafe.Pointer(p)
|
||||
}
|
||||
|
||||
reservationFailed:
|
||||
// If using 64-bit, our reservation is all we have.
|
||||
if sys.PtrSize != 4 {
|
||||
return nil
|
||||
|
||||
@@ -503,6 +503,11 @@ func (h *mheap) init(spansStart, spansBytes uintptr) {
|
||||
sp.array = unsafe.Pointer(spansStart)
|
||||
sp.len = 0
|
||||
sp.cap = int(spansBytes / sys.PtrSize)
|
||||
|
||||
// Map metadata structures. But don't map race detector memory
|
||||
// since we're not actually growing the arena here (and TSAN
|
||||
// gets mad if you map 0 bytes).
|
||||
h.setArenaUsed(h.arena_used, false)
|
||||
}
|
||||
|
||||
// setArenaUsed extends the usable arena to address arena_used and
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"internal/testenv"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -20,11 +21,12 @@ import (
|
||||
"runtime/pprof/internal/profile"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func cpuHogger(f func(), dur time.Duration) {
|
||||
func cpuHogger(f func() int, dur time.Duration) {
|
||||
// We only need to get one 100 Hz clock tick, so we've got
|
||||
// a large safety buffer.
|
||||
// But do at least 500 iterations (which should take about 100ms),
|
||||
@@ -44,7 +46,7 @@ var (
|
||||
// The actual CPU hogging function.
|
||||
// Must not call other functions nor access heap/globals in the loop,
|
||||
// otherwise under race detector the samples will be in the race runtime.
|
||||
func cpuHog1() {
|
||||
func cpuHog1() int {
|
||||
foo := salt1
|
||||
for i := 0; i < 1e5; i++ {
|
||||
if foo > 0 {
|
||||
@@ -53,10 +55,10 @@ func cpuHog1() {
|
||||
foo *= foo + 1
|
||||
}
|
||||
}
|
||||
salt1 = foo
|
||||
return foo
|
||||
}
|
||||
|
||||
func cpuHog2() {
|
||||
func cpuHog2() int {
|
||||
foo := salt2
|
||||
for i := 0; i < 1e5; i++ {
|
||||
if foo > 0 {
|
||||
@@ -65,7 +67,7 @@ func cpuHog2() {
|
||||
foo *= foo + 2
|
||||
}
|
||||
}
|
||||
salt2 = foo
|
||||
return foo
|
||||
}
|
||||
|
||||
func TestCPUProfile(t *testing.T) {
|
||||
@@ -93,8 +95,9 @@ func TestCPUProfileInlining(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func inlinedCaller() {
|
||||
func inlinedCaller() int {
|
||||
inlinedCallee()
|
||||
return 0
|
||||
}
|
||||
|
||||
func inlinedCallee() {
|
||||
@@ -713,3 +716,54 @@ func TestCPUProfileLabel(t *testing.T) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestLabelRace(t *testing.T) {
|
||||
// Test the race detector annotations for synchronization
|
||||
// between settings labels and consuming them from the
|
||||
// profile.
|
||||
testCPUProfile(t, []string{"runtime/pprof.cpuHogger;key=value"}, func(dur time.Duration) {
|
||||
start := time.Now()
|
||||
var wg sync.WaitGroup
|
||||
for time.Since(start) < dur {
|
||||
for i := 0; i < 10; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
Do(context.Background(), Labels("key", "value"), func(context.Context) {
|
||||
cpuHogger(cpuHog1, time.Millisecond)
|
||||
})
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Check that there is no deadlock when the program receives SIGPROF while in
|
||||
// 64bit atomics' critical section. Used to happen on mips{,le}. See #20146.
|
||||
func TestAtomicLoadStore64(t *testing.T) {
|
||||
f, err := ioutil.TempFile("", "profatomic")
|
||||
if err != nil {
|
||||
t.Fatalf("TempFile: %v", err)
|
||||
}
|
||||
defer os.Remove(f.Name())
|
||||
defer f.Close()
|
||||
|
||||
if err := StartCPUProfile(f); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer StopCPUProfile()
|
||||
|
||||
var flag uint64
|
||||
done := make(chan bool, 1)
|
||||
|
||||
go func() {
|
||||
for atomic.LoadUint64(&flag) == 0 {
|
||||
runtime.Gosched()
|
||||
}
|
||||
done <- true
|
||||
}()
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
atomic.StoreUint64(&flag, 1)
|
||||
<-done
|
||||
}
|
||||
|
||||
@@ -3232,10 +3232,14 @@ var prof struct {
|
||||
hz int32
|
||||
}
|
||||
|
||||
func _System() { _System() }
|
||||
func _ExternalCode() { _ExternalCode() }
|
||||
func _LostExternalCode() { _LostExternalCode() }
|
||||
func _GC() { _GC() }
|
||||
func _System() { _System() }
|
||||
func _ExternalCode() { _ExternalCode() }
|
||||
func _LostExternalCode() { _LostExternalCode() }
|
||||
func _GC() { _GC() }
|
||||
func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() }
|
||||
|
||||
// Counts SIGPROFs received while in atomic64 critical section, on mips{,le}
|
||||
var lostAtomic64Count uint64
|
||||
|
||||
// Called if we receive a SIGPROF signal.
|
||||
// Called by the signal handler, may run during STW.
|
||||
@@ -3245,6 +3249,21 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
|
||||
return
|
||||
}
|
||||
|
||||
// On mips{,le}, 64bit atomics are emulated with spinlocks, in
|
||||
// runtime/internal/atomic. If SIGPROF arrives while the program is inside
|
||||
// the critical section, it creates a deadlock (when writing the sample).
|
||||
// As a workaround, create a counter of SIGPROFs while in critical section
|
||||
// to store the count, and pass it to sigprof.add() later when SIGPROF is
|
||||
// received from somewhere else (with _LostSIGPROFDuringAtomic64 as pc).
|
||||
if GOARCH == "mips" || GOARCH == "mipsle" {
|
||||
if f := findfunc(pc); f.valid() {
|
||||
if hasprefix(funcname(f), "runtime/internal/atomic") {
|
||||
lostAtomic64Count++
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Profiling runs concurrently with GC, so it must not allocate.
|
||||
// Set a trap in case the code does allocate.
|
||||
// Note that on windows, one thread takes profiles of all the
|
||||
@@ -3371,6 +3390,10 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
|
||||
}
|
||||
|
||||
if prof.hz != 0 {
|
||||
if (GOARCH == "mips" || GOARCH == "mipsle") && lostAtomic64Count > 0 {
|
||||
cpuprof.addLostAtomic64(lostAtomic64Count)
|
||||
lostAtomic64Count = 0
|
||||
}
|
||||
cpuprof.add(gp, stk[:n])
|
||||
}
|
||||
getg().m.mallocing--
|
||||
|
||||
@@ -545,7 +545,7 @@ Read:
|
||||
b.rNext = br.addCountsAndClearFlags(skip+di, ti)
|
||||
|
||||
if raceenabled {
|
||||
// Match racewritepc in runtime_setProfLabel,
|
||||
// Match racereleasemerge in runtime_setProfLabel,
|
||||
// so that the setting of the labels in runtime_setProfLabel
|
||||
// is treated as happening before any use of the labels
|
||||
// by our caller. The synchronization on labelSync itself is a fiction
|
||||
|
||||
@@ -13,8 +13,23 @@ func runtime_setProfLabel(labels unsafe.Pointer) {
|
||||
// Introduce race edge for read-back via profile.
|
||||
// This would more properly use &getg().labels as the sync address,
|
||||
// but we do the read in a signal handler and can't call the race runtime then.
|
||||
//
|
||||
// This uses racereleasemerge rather than just racerelease so
|
||||
// the acquire in profBuf.read synchronizes with *all* prior
|
||||
// setProfLabel operations, not just the most recent one. This
|
||||
// is important because profBuf.read will observe different
|
||||
// labels set by different setProfLabel operations on
|
||||
// different goroutines, so it needs to synchronize with all
|
||||
// of them (this wouldn't be an issue if we could synchronize
|
||||
// on &getg().labels since we would synchronize with each
|
||||
// most-recent labels write separately.)
|
||||
//
|
||||
// racereleasemerge is like a full read-modify-write on
|
||||
// labelSync, rather than just a store-release, so it carries
|
||||
// a dependency on the previous racereleasemerge, which
|
||||
// ultimately carries forward to the acquire in profBuf.read.
|
||||
if raceenabled {
|
||||
racerelease(unsafe.Pointer(&labelSync))
|
||||
racereleasemerge(unsafe.Pointer(&labelSync))
|
||||
}
|
||||
getg().labels = labels
|
||||
}
|
||||
|
||||
@@ -259,4 +259,25 @@ Goroutine [0-9] \(running\) created at:
|
||||
runtime\.newextram\(\)
|
||||
.*/runtime/proc.go:[0-9]+ \+0x[0-9,a-f]+
|
||||
==================`},
|
||||
{"second_test_passes", "test", "", "atexit_sleep_ms=0", `
|
||||
package main_test
|
||||
import "testing"
|
||||
func TestFail(t *testing.T) {
|
||||
done := make(chan bool)
|
||||
x := 0
|
||||
go func() {
|
||||
x = 42
|
||||
done <- true
|
||||
}()
|
||||
x = 43
|
||||
<-done
|
||||
}
|
||||
|
||||
func TestPass(t *testing.T) {
|
||||
}
|
||||
`, `
|
||||
==================
|
||||
--- FAIL: TestFail \(0...s\)
|
||||
.*testing.go:.*: race detected during execution of test
|
||||
FAIL`},
|
||||
}
|
||||
|
||||
@@ -409,6 +409,11 @@ var modulesSlice unsafe.Pointer // see activeModules
|
||||
//
|
||||
// A module is active once its gcdatamask and gcbssmask have been
|
||||
// assembled and it is usable by the GC.
|
||||
//
|
||||
// This is nosplit/nowritebarrier because it is called by the
|
||||
// cgo pointer checking code.
|
||||
//go:nosplit
|
||||
//go:nowritebarrier
|
||||
func activeModules() []*moduledata {
|
||||
p := (*[]*moduledata)(atomic.Loadp(unsafe.Pointer(&modulesSlice)))
|
||||
if p == nil {
|
||||
|
||||
@@ -100,7 +100,7 @@ TEXT runtime·usleep(SB),NOSPLIT,$8
|
||||
MOVL AX, 0(SP)
|
||||
MOVL $1000, AX // usec to nsec
|
||||
MULL DX
|
||||
MOVL DX, 4(SP)
|
||||
MOVL AX, 4(SP)
|
||||
|
||||
// pselect6(0, 0, 0, 0, &ts, 0)
|
||||
MOVL $308, AX
|
||||
|
||||
@@ -695,8 +695,7 @@ func tRunner(t *T, fn func(t *T)) {
|
||||
// a call to runtime.Goexit, record the duration and send
|
||||
// a signal saying that the test is done.
|
||||
defer func() {
|
||||
t.raceErrors += race.Errors()
|
||||
if t.raceErrors > 0 {
|
||||
if t.raceErrors+race.Errors() > 0 {
|
||||
t.Errorf("race detected during execution of test")
|
||||
}
|
||||
|
||||
@@ -970,7 +969,7 @@ func listTests(matchString func(pat, str string) (bool, error), tests []Internal
|
||||
}
|
||||
}
|
||||
for _, example := range examples {
|
||||
if ok, _ := matchString(*matchList, example.Name); ok && example.Output != "" {
|
||||
if ok, _ := matchString(*matchList, example.Name); ok {
|
||||
fmt.Println(example.Name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,14 @@ func testZoneAbbr(t *testing.T) {
|
||||
t1 := Now()
|
||||
// discard nsec
|
||||
t1 = Date(t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second(), 0, t1.Location())
|
||||
|
||||
// Skip the test if we're in a timezone with no abbreviation.
|
||||
// Format will fallback to the numeric abbreviation, and
|
||||
// Parse(RFC1123, ..) will fail (see Issue 21183).
|
||||
if tz := t1.Format("MST"); tz[0] == '-' || tz[0] == '+' {
|
||||
t.Skip("No zone abbreviation")
|
||||
}
|
||||
|
||||
t2, err := Parse(RFC1123, t1.Format(RFC1123))
|
||||
if err != nil {
|
||||
t.Fatalf("Parse failed: %v", err)
|
||||
|
||||
15
test/README.md
Normal file
15
test/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
The test directory contains tests of the Go tool chain and runtime.
|
||||
It includes black box tests, regression tests, and error output tests.
|
||||
They are run as part of all.bash.
|
||||
|
||||
To run just these tests, execute:
|
||||
|
||||
go run run.go
|
||||
|
||||
Standard library tests should be written as regular Go tests in the appropriate package.
|
||||
|
||||
The tool chain and runtime also have regular Go tests in their packages.
|
||||
The main reasons to add a new test to this directory are:
|
||||
|
||||
* it is most naturally expressed using the test runner; or
|
||||
* it is also applicable to `gccgo` and other Go tool chains.
|
||||
Reference in New Issue
Block a user