<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/cmd/compile/internal/ssa/stackalloc.go, branch json-isValidNumber</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=json-isValidNumber</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=json-isValidNumber'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2022-10-31T21:41:20Z</updated>
<entry>
<title>cmd/compile: add cache of sizeable objects so they can be reused</title>
<updated>2022-10-31T21:41:20Z</updated>
<author>
<name>Keith Randall</name>
<email>khr@golang.org</email>
</author>
<published>2022-10-18T23:07:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=68bd383368b5958f8f02c49bc75134a0ef61daec'/>
<id>urn:sha1:68bd383368b5958f8f02c49bc75134a0ef61daec</id>
<content type='text'>
We kind of have this mechanism already, just normalizing it and
using it in a bunch of places. Previously a bunch of places cached
slices only for the duration of a single function compilation. Now
we can reuse slices across a whole compiler run.

Use a sync.Pool of powers-of-two sizes. This lets us use not
too much memory, and avoid holding onto memory we're no longer
using when a GC happens.

There's a few different types we need, so generate the code for it.
Generics would be useful here, but we can't use generics in the
compiler because of bootstrapping.

Change-Id: I6cf37e7b7b2e802882aaa723a0b29770511ccd82
Reviewed-on: https://go-review.googlesource.com/c/go/+/444820
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
Reviewed-by: Heschi Kreinick &lt;heschi@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: David Chase &lt;drchase@google.com&gt;
</content>
</entry>
<entry>
<title>cmd/compile: manage Slot array better</title>
<updated>2021-05-08T17:03:18Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-04-21T14:55:42Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b38b1b2f9ae710ee2c16a103bb21644f1adbc5d3'/>
<id>urn:sha1:b38b1b2f9ae710ee2c16a103bb21644f1adbc5d3</id>
<content type='text'>
steals idea from CL 312093

further investigation revealed additional duplicate
slots (equivalent, but not equal), so delete those too.

Rearranged Func.Names to be addresses of slots,
create canonical addresses so that split slots
(which use those addresses to refer to their parent,
and split slots can be further split)
will preserve "equivalent slots are equal".

Removes duplicates, improves metrics for "args at entry".

Change-Id: I5bbdcb50bd33655abcab3d27ad8cdce25499faaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/312292
Trust: David Chase &lt;drchase@google.com&gt;
Run-TryBot: David Chase &lt;drchase@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>cmd/compile: make the stack allocator more careful about register args.</title>
<updated>2021-05-03T17:46:12Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-04-24T01:49:08Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=90ec25773523ac2c5e075f1e5d7519ee08201b8c'/>
<id>urn:sha1:90ec25773523ac2c5e075f1e5d7519ee08201b8c</id>
<content type='text'>
Assignment between input parameters causes them to have more than
one "Name", and running this backwards from names to values can end
up confusing (conflating) parameter spill slots.

Around 105a6e9518, this cases a stack overflow running
go test -race encoding/pem
because two slice parameters spill (incorrectly) into the same
stack slots (in the AB?I-defined parameter spill area).

This also tickles a failure in cue, which turned out to be
easier to isolate.

Fixes #45851.
Updates #40724.

Change-Id: I39c56815bd6abb652f1ccbe83c47f4f373a125c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/313212
Trust: David Chase &lt;drchase@google.com&gt;
Run-TryBot: David Chase &lt;drchase@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Cherry Zhang &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>cmd/compile: spill all the parameters around morestack</title>
<updated>2021-04-16T20:12:20Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-04-16T04:15:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b6e1c336037e53ae095e84cfed4a312d8fd3ad45'/>
<id>urn:sha1:b6e1c336037e53ae095e84cfed4a312d8fd3ad45</id>
<content type='text'>
former code only spilled those parameters mentioned in code
AT THE REGISTER LEVEL, this caused problems with liveness
sometimes (which worked on whole variables including
aggregates).

Updates #40724.

Change-Id: Ib9fdc50d95d1d2b1f1e405dd370540e88582ac71
Reviewed-on: https://go-review.googlesource.com/c/go/+/310690
Trust: David Chase &lt;drchase@google.com&gt;
Run-TryBot: David Chase &lt;drchase@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Cherry Zhang &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>Revert "cmd/compile: ensure spills of int/float reg args land in abi slots"</title>
<updated>2021-04-09T15:01:13Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-04-09T14:53:33Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=6951da56b0ae2cd4250fc1b0350d090aed633ac1'/>
<id>urn:sha1:6951da56b0ae2cd4250fc1b0350d090aed633ac1</id>
<content type='text'>
This reverts CL 308510.

Reason for revert: It breaks "GOEXPERIMENT=regabi,regabiargs ./make.bash"

Change-Id: I553654690ec73120f8a6258dd80623853c430df0
Reviewed-on: https://go-review.googlesource.com/c/go/+/308932
Trust: David Chase &lt;drchase@google.com&gt;
Reviewed-by: Cherry Zhang &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>cmd/compile: ensure spills of int/float reg args land in abi slots</title>
<updated>2021-04-09T14:33:44Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-04-07T13:58:02Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=a690a5d75fee3b23e9ab80bd7b48cafb52ce4615'/>
<id>urn:sha1:a690a5d75fee3b23e9ab80bd7b48cafb52ce4615</id>
<content type='text'>
We noticed a while ago that register argument spills were not always
landing where they should.

Updates #40724.

Change-Id: I0b7c3279a2f6270577481c252bae4568cbb6e796
Reviewed-on: https://go-review.googlesource.com/c/go/+/308510
Trust: David Chase &lt;drchase@google.com&gt;
Run-TryBot: David Chase &lt;drchase@google.com&gt;
Reviewed-by: Cherry Zhang &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>cmd/compile: register abi, morestack work and mole whacking</title>
<updated>2021-03-04T16:19:12Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-02-19T22:11:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=a2d92b5143ad6ed1b55b71032c5c1f468ba76fd4'/>
<id>urn:sha1:a2d92b5143ad6ed1b55b71032c5c1f468ba76fd4</id>
<content type='text'>
Morestack works for non-pointer register parameters

Within a function body, pointer-typed parameters are correctly
tracked.

Results still not hooked up.

For #40724.

Change-Id: Icaee0b51d0da54af983662d945d939b756088746
Reviewed-on: https://go-review.googlesource.com/c/go/+/294410
Trust: David Chase &lt;drchase@google.com&gt;
Reviewed-by: Cherry Zhang &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>cmd/compile: handle aggregate OpArg in registers</title>
<updated>2021-03-03T15:00:48Z</updated>
<author>
<name>David Chase</name>
<email>drchase@google.com</email>
</author>
<published>2021-02-17T15:38:03Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=9f33dc3ca1b7b6bdb1a8e83c24d490f579bbbdc8'/>
<id>urn:sha1:9f33dc3ca1b7b6bdb1a8e83c24d490f579bbbdc8</id>
<content type='text'>
Also handles case where OpArg does not escape but has its address
taken.

May have exposed a lurking bug in 1.16 expandCalls,
if e.g., loading len(someArrayOfstructThing[0].secondStringField)
from a local.  Maybe.

For #40724.

Change-Id: I0298c4ad5d652b5e3d7ed6a62095d59e2d8819c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/293396
Trust: David Chase &lt;drchase@google.com&gt;
Reviewed-by: Cherry Zhang &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>[dev.regabi] cmd/compile: change LocalSlot.N to *ir.Name</title>
<updated>2020-12-08T01:46:40Z</updated>
<author>
<name>Matthew Dempsky</name>
<email>mdempsky@google.com</email>
</author>
<published>2020-12-06T20:02:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=dcec658f6c9798b226d2f1e72a7b22b613e95c00'/>
<id>urn:sha1:dcec658f6c9798b226d2f1e72a7b22b613e95c00</id>
<content type='text'>
This was already documented as always being an ONAME, so it just
needed a few type assertion changes.

Passes buildall w/ toolstash -cmp.

Updates #42982.

Change-Id: I61f4b6ebd57c43b41977f4b37b81fe94fb11a723
Reviewed-on: https://go-review.googlesource.com/c/go/+/275757
Run-TryBot: Matthew Dempsky &lt;mdempsky@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Cuong Manh Le &lt;cuong.manhle.vn@gmail.com&gt;
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
Trust: Matthew Dempsky &lt;mdempsky@google.com&gt;
</content>
</entry>
<entry>
<title>[dev.regabi] cmd/compile: replace *Node type with an interface Node [generated]</title>
<updated>2020-11-25T17:30:43Z</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2020-11-25T06:11:56Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=41f3af9d04362a56c1af186af134c704a03fa97b'/>
<id>urn:sha1:41f3af9d04362a56c1af186af134c704a03fa97b</id>
<content type='text'>
The plan is to introduce a Node interface that replaces the old *Node pointer-to-struct.

The previous CL defined an interface INode modeling a *Node.

This CL:
 - Changes all references outside internal/ir to use INode,
   along with many references inside internal/ir as well.
 - Renames Node to node.
 - Renames INode to Node

So now ir.Node is an interface implemented by *ir.node, which is otherwise inaccessible,
and the code outside package ir is now (clearly) using only the interface.

The usual rule is never to redefine an existing name with a new meaning,
so that old code that hasn't been updated gets a "unknown name" error
instead of more mysterious errors or silent misbehavior. That rule would
caution against replacing Node-the-struct with Node-the-interface,
as in this CL, because code that says *Node would now be using a pointer
to an interface. But this CL is being landed at the same time as another that
moves Node from gc to ir. So the net effect is to replace *gc.Node with ir.Node,
which does follow the rule: any lingering references to gc.Node will be told
it's gone, not silently start using pointers to interfaces. So the rule is followed
by the CL sequence, just not this specific CL.

Overall, the loss of inlining caused by using interfaces cuts the compiler speed
by about 6%, a not insignificant amount. However, as we convert the representation
to concrete structs that are not the giant Node over the next weeks, that speed
should come back as more of the compiler starts operating directly on concrete types
and the memory taken up by the graph of Nodes drops due to the more precise
structs. Honestly, I was expecting worse.

% benchstat bench.old bench.new
name                      old time/op       new time/op       delta
Template                        168ms ± 4%        182ms ± 2%   +8.34%  (p=0.000 n=9+9)
Unicode                        72.2ms ±10%       82.5ms ± 6%  +14.38%  (p=0.000 n=9+9)
GoTypes                         563ms ± 8%        598ms ± 2%   +6.14%  (p=0.006 n=9+9)
Compiler                        2.89s ± 4%        3.04s ± 2%   +5.37%  (p=0.000 n=10+9)
SSA                             6.45s ± 4%        7.25s ± 5%  +12.41%  (p=0.000 n=9+10)
Flate                           105ms ± 2%        115ms ± 1%   +9.66%  (p=0.000 n=10+8)
GoParser                        144ms ±10%        152ms ± 2%   +5.79%  (p=0.011 n=9+8)
Reflect                         345ms ± 9%        370ms ± 4%   +7.28%  (p=0.001 n=10+9)
Tar                             149ms ± 9%        161ms ± 5%   +8.05%  (p=0.001 n=10+9)
XML                             190ms ± 3%        209ms ± 2%   +9.54%  (p=0.000 n=9+8)
LinkCompiler                    327ms ± 2%        325ms ± 2%     ~     (p=0.382 n=8+8)
ExternalLinkCompiler            1.77s ± 4%        1.73s ± 6%     ~     (p=0.113 n=9+10)
LinkWithoutDebugCompiler        214ms ± 4%        211ms ± 2%     ~     (p=0.360 n=10+8)
StdCmd                          14.8s ± 3%        15.9s ± 1%   +6.98%  (p=0.000 n=10+9)
[Geo mean]                      480ms             510ms        +6.31%

name                      old user-time/op  new user-time/op  delta
Template                        223ms ± 3%        237ms ± 3%   +6.16%  (p=0.000 n=9+10)
Unicode                         103ms ± 6%        113ms ± 3%   +9.53%  (p=0.000 n=9+9)
GoTypes                         758ms ± 8%        800ms ± 2%   +5.55%  (p=0.003 n=10+9)
Compiler                        3.95s ± 2%        4.12s ± 2%   +4.34%  (p=0.000 n=10+9)
SSA                             9.43s ± 1%        9.74s ± 4%   +3.25%  (p=0.000 n=8+10)
Flate                           132ms ± 2%        141ms ± 2%   +6.89%  (p=0.000 n=9+9)
GoParser                        177ms ± 9%        183ms ± 4%     ~     (p=0.050 n=9+9)
Reflect                         467ms ±10%        495ms ± 7%   +6.17%  (p=0.029 n=10+10)
Tar                             183ms ± 9%        197ms ± 5%   +7.92%  (p=0.001 n=10+10)
XML                             249ms ± 5%        268ms ± 4%   +7.82%  (p=0.000 n=10+9)
LinkCompiler                    544ms ± 5%        544ms ± 6%     ~     (p=0.863 n=9+9)
ExternalLinkCompiler            1.79s ± 4%        1.75s ± 6%     ~     (p=0.075 n=10+10)
LinkWithoutDebugCompiler        248ms ± 6%        246ms ± 2%     ~     (p=0.965 n=10+8)
[Geo mean]                      483ms             504ms        +4.41%

[git-generate]
cd src/cmd/compile/internal/ir
: # We need to do the conversion in multiple steps, so we introduce
: # a temporary type alias that will start out meaning the pointer-to-struct
: # and then change to mean the interface.
rf '
	mv Node OldNode

	add node.go \
		type Node = *OldNode
'

: # It should work to do this ex in ir, but it misses test files, due to a bug in rf.
: # Run the command in gc to handle gc's tests, and then again in ssa for ssa's tests.
cd ../gc
rf '
        ex .  ../arm ../riscv64 ../arm64 ../mips64 ../ppc64 ../mips ../wasm {
                import "cmd/compile/internal/ir"
                *ir.OldNode -&gt; ir.Node
        }
'
cd ../ssa
rf '
        ex {
                import "cmd/compile/internal/ir"
                *ir.OldNode -&gt; ir.Node
        }
'

: # Back in ir, finish conversion clumsily with sed,
: # because type checking and circular aliases do not mix.
cd ../ir
sed -i '' '
	/type Node = \*OldNode/d
	s/\*OldNode/Node/g
	s/^func (n Node)/func (n *OldNode)/
	s/OldNode/node/g
	s/type INode interface/type Node interface/
	s/var _ INode = (Node)(nil)/var _ Node = (*node)(nil)/
' *.go
gofmt -w *.go

sed -i '' '
	s/{Func{}, 136, 248}/{Func{}, 152, 280}/
	s/{Name{}, 32, 56}/{Name{}, 44, 80}/
	s/{Param{}, 24, 48}/{Param{}, 44, 88}/
	s/{node{}, 76, 128}/{node{}, 88, 152}/
' sizeof_test.go

cd ../ssa
sed -i '' '
	s/{LocalSlot{}, 28, 40}/{LocalSlot{}, 32, 48}/
' sizeof_test.go

cd ../gc
sed -i '' 's/\*ir.Node/ir.Node/' mkbuiltin.go

cd ../../../..
go install std cmd
cd cmd/compile
go test -u || go test -u

Change-Id: I196bbe3b648e4701662e4a2bada40bf155e2a553
Reviewed-on: https://go-review.googlesource.com/c/go/+/272935
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
</content>
</entry>
</feed>
