<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/runtime/asm_amd64.s, branch json-isValidNumber-before</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=json-isValidNumber-before</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=json-isValidNumber-before'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2023-01-25T15:14:29Z</updated>
<entry>
<title>runtime: mark amd64 runtime·rt0_go as NOFRAME</title>
<updated>2023-01-25T15:14:29Z</updated>
<author>
<name>qmuntal</name>
<email>quimmuntal@gmail.com</email>
</author>
<published>2023-01-25T08:21:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=7a5460ed9b53ac99805e6578cc67da8ef431c577'/>
<id>urn:sha1:7a5460ed9b53ac99805e6578cc67da8ef431c577</id>
<content type='text'>
This CL adds the NOFRAME flag to runtime·rt0_go, which should
had been added in CL 459395 but didn't and broke fix windows-amd64-2008.

Change-Id: I4583f2034bf114e1f7aaddef9ba505f53536c3eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/463120
Run-TryBot: Quim Muntal &lt;quimmuntal@gmail.com&gt;
Reviewed-by: Bryan Mills &lt;bcmills@google.com&gt;
Auto-Submit: Quim Muntal &lt;quimmuntal@gmail.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
</content>
</entry>
<entry>
<title>runtime: use explicit NOFRAME on windows/amd64</title>
<updated>2023-01-24T19:29:51Z</updated>
<author>
<name>qmuntal</name>
<email>quimmuntal@gmail.com</email>
</author>
<published>2022-12-23T12:22:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=083d94f69c35b2244ea43738c1d28aa5d9e6d567'/>
<id>urn:sha1:083d94f69c35b2244ea43738c1d28aa5d9e6d567</id>
<content type='text'>
This CL marks non-leaf nosplit assembly functions as NOFRAME to avoid
relying on the implicit amd64 NOFRAME heuristic, where NOSPLIT functions
without stack were also marked as NOFRAME.

Updates #57302
Updates #40044

Change-Id: Ia4d26f8420dcf2b54528969ffbf40a73f1315d61
Reviewed-on: https://go-review.googlesource.com/c/go/+/459395
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
Run-TryBot: Quim Muntal &lt;quimmuntal@gmail.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
</content>
</entry>
<entry>
<title>runtime: switch AMD64's publicationBarrier to ABIInternal</title>
<updated>2023-01-24T19:11:33Z</updated>
<author>
<name>Jakub Ciolek</name>
<email>jakub@ciolek.dev</email>
</author>
<published>2023-01-18T09:54:17Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=02704d515952f87bf81195859edcdc49f28af02e'/>
<id>urn:sha1:02704d515952f87bf81195859edcdc49f28af02e</id>
<content type='text'>
Shrinks a few runtime functions:

runtime
runtime.mallocgc 2127 -&gt; 2117  (-0.47%)
runtime.(*mheap).initSpan 652 -&gt; 639  (-1.99%)
runtime.(*mspan).userArenaNextFree 825 -&gt; 808  (-2.06%)

file      before   after    Δ       %
runtime.s 512473   512414   -59     -0.012%
total     20843331 20843272 -59     -0.000%

Change-Id: Ifaca7abb6db3467b73945fac71496dd7527e6863
Reviewed-on: https://go-review.googlesource.com/c/go/+/462296
Auto-Submit: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: Jakub Ciolek &lt;jakub@ciolek.dev&gt;
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: remove 104 byte stack guard</title>
<updated>2023-01-20T04:55:48Z</updated>
<author>
<name>liu-xuewen</name>
<email>liiuxuewen@gmail.com</email>
</author>
<published>2022-11-05T07:40:49Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=57236fe9f72c7dae447f07899e9b5b3bcd06f2af'/>
<id>urn:sha1:57236fe9f72c7dae447f07899e9b5b3bcd06f2af</id>
<content type='text'>
The number 104 appears to date back to the
first implementation of split stacks in
https://go.googlesource.com/go/+/b987f7a757f53f460973622a36eebb696f9b5060.
That change introduces a 104 byte stack guard.
it doesn't makes any sense today.

Change-Id: I73069f6d1a827653af63e616f0119fbac809882e
GitHub-Last-Rev: bcf900059047548c1709c6d4cf4649a96ad85e57
GitHub-Pull-Request: golang/go#56594
Reviewed-on: https://go-review.googlesource.com/c/go/+/448036
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
</content>
</entry>
<entry>
<title>runtime,cmd/internal/obj/x86: use TEB TLS slots on windows/amd64</title>
<updated>2022-11-14T20:43:12Z</updated>
<author>
<name>qmuntal</name>
<email>quimmuntal@gmail.com</email>
</author>
<published>2022-09-19T10:19:38Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=da564d0006e2cc286fecb3cec94ed143a2667866'/>
<id>urn:sha1:da564d0006e2cc286fecb3cec94ed143a2667866</id>
<content type='text'>
This CL redesign how we get the TLS pointer on windows/amd64.

We were previously reading it from the [TEB] arbitrary data slot,
located at 0x28(GS), which can only hold 1 TLS pointer.

With this CL, we will read the TLS pointer from the TEB TLS slot array,
located at 0x1480(GS). The TLS slot array can hold multiple
TLS pointers, up to 64, so multiple Go runtimes running on the
same thread can coexists with different TLS.

Each new TLS slot has to be allocated via [TlsAlloc],
which returns the slot index. This index can then be used to get the
slot offset from GS with the following formula: 0x1480 + index*8

The slot index is fixed per Go runtime, so we can store it
in runtime.tls_g and use it latter on to read/update the TLS pointer.

Loading the TLS pointer requires the following asm instructions:

  MOVQ runtime.tls_g, AX
  MOVQ AX(GS), AX

Notice that this approach is also implemented on windows/arm64.

[TEB]: https://en.wikipedia.org/wiki/Win32_Thread_Information_Block
[TlsAlloc]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlsalloc

Updates #22192

Change-Id: Idea7119fd76a3cd083979a4d57ed64b552fa101b
Reviewed-on: https://go-review.googlesource.com/c/go/+/431775
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Quim Muntal &lt;quimmuntal@gmail.com&gt;
Reviewed-by: Michael Knyszek &lt;mknyszek@google.com&gt;
Reviewed-by: Alex Brainman &lt;alex.brainman@gmail.com&gt;
</content>
</entry>
<entry>
<title>all: fix spelling</title>
<updated>2022-05-18T00:47:29Z</updated>
<author>
<name>John Bampton</name>
<email>jbampton@gmail.com</email>
</author>
<published>2022-05-17T23:37:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=20db15ce12fd7349fb160fc0bf556efb24eaac84'/>
<id>urn:sha1:20db15ce12fd7349fb160fc0bf556efb24eaac84</id>
<content type='text'>
Change-Id: I63eb42f3ce5ca452279120a5b33518f4ce16be45
GitHub-Last-Rev: a88f2f72bef402344582ae997a4907457002b5df
GitHub-Pull-Request: golang/go#52951
Reviewed-on: https://go-review.googlesource.com/c/go/+/406843
Run-TryBot: Robert Griesemer &lt;gri@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Robert Griesemer &lt;gri@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>runtime: check GOAMD64 v4 compatibility on Darwin</title>
<updated>2022-04-01T00:05:05Z</updated>
<author>
<name>vpachkov</name>
<email>slava.pach@gmail.com</email>
</author>
<published>2021-11-19T11:38:23Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=6a40bdcbaf97ca6a815bf48998d90ccfa5a0b6fc'/>
<id>urn:sha1:6a40bdcbaf97ca6a815bf48998d90ccfa5a0b6fc</id>
<content type='text'>
Darwin requires a different approach to check AVX512 support.

Update #45453

Change-Id: Ia3dfecc04b47aab16f472000e92e46d4fc6d596d
Reviewed-on: https://go-review.googlesource.com/c/go/+/365395
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Trust: Heschi Kreinick &lt;heschi@google.com&gt;
</content>
</entry>
<entry>
<title>runtime: check GOAMD64 compatibility after setting up TLS</title>
<updated>2021-11-16T23:52:13Z</updated>
<author>
<name>Keith Randall</name>
<email>khr@golang.org</email>
</author>
<published>2021-11-15T23:56:39Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=01b6cf09fc9f272d9db3d30b4c93982f4911d120'/>
<id>urn:sha1:01b6cf09fc9f272d9db3d30b4c93982f4911d120</id>
<content type='text'>
We need TLS set up to be able to print an error without crashing.

Fixes #49586
Update #45453

Change-Id: I97f0efcd716a8dca614e82ab73f2d855b7277599
Reviewed-on: https://go-review.googlesource.com/c/go/+/364174
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Martin Möhrmann &lt;martin@golang.org&gt;
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Trust: Keith Randall &lt;khr@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: check amd64 microarchitecture level at startup</title>
<updated>2021-11-02T16:40:04Z</updated>
<author>
<name>vpachkov</name>
<email>slava.pach@gmail.com</email>
</author>
<published>2021-10-31T11:06:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=8c8baad927b2fd0bca589bacab658fe0f7eb5dac'/>
<id>urn:sha1:8c8baad927b2fd0bca589bacab658fe0f7eb5dac</id>
<content type='text'>
Make Go runtime throw if it's been compiled to assume instruction
set extensions that aren't available on the CPU.
Updates #48506

Change-Id: Ic4d6696e1cd6b28d389a86fe64e8175ea3ca135a
GitHub-Last-Rev: ba338377f549344b416fbd519576e95ce5d523be
GitHub-Pull-Request: golang/go#48514
Reviewed-on: https://go-review.googlesource.com/c/go/+/351191
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Martin Möhrmann &lt;martin@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: use RDTSCP for instruction stream serialized read of TSC</title>
<updated>2021-08-23T20:32:04Z</updated>
<author>
<name>Martin Möhrmann</name>
<email>martin@golang.org</email>
</author>
<published>2021-08-23T11:53:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=22540abf76a693bc9e4c550203d8ccbaa60c12e2'/>
<id>urn:sha1:22540abf76a693bc9e4c550203d8ccbaa60c12e2</id>
<content type='text'>
To measure all instructions having been completed before reading
the time stamp counter with RDTSC an instruction sequence that
has instruction stream serializing properties which guarantee
waiting until all previous instructions have been executed is
needed. This does not necessary mean to wait for all stores to
be globally visible.

This CL aims to remove vendor specific logic for determining the
instruction sequence with CPU feature flag checks that are
CPU vendor independent.

For intel LFENCE has the wanted properties at least
since it was introduced together with SSE2 support.

On AMD instruction stream serializing LFENCE is supported by setting
an MSR C001_1029[1]=1 on AMD family 10h/12h/14h/15h/16h/17h processors.
AMD family 0Fh/11h processors support LFENCE as serializing always.
AMD plans support for this MSR and access to this bit for all future processors.
Source: https://developer.amd.com/wp-content/resources/Managing-Speculation-on-AMD-Processors.pdf

Reading the MSR to determine LFENCE properties is not always possible
or reliable (hypervisors). The Linux kernel is relying on serializing
LFENCE on AMD CPUs since a commit in July 2019: https://lkml.org/lkml/2019/7/22/295
and the MSR C001_1029 to enable serialization has been set by default
with the Spectre v1 mitigations.

Using an MFENCE on AMD is waiting on previous instructions having been executed
but in addition also flushes store buffers.

To align the serialization properties without runtime detection
of CPU manufacturers we can use the newer RDTSCP instruction which
waits until all previous instructions have been executed.

RDTSCP is available on Intel since around 2008 and on AMD CPUs since
around 2006. Support for RDTSCP can be checked independently
of manufacturer by checking CPUID bits.

Using RDTSCP is the default in Linux to read TSC in program order
when the instruction is available.
https://github.com/torvalds/linux/blob/e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93/arch/x86/include/asm/msr.h#L231

Change-Id: Ifa841843b9abb2816f8f0754a163ebf01385306d
Reviewed-on: https://go-review.googlesource.com/c/go/+/344429
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
</entry>
</feed>
