Skip to content

Commit f0ff6c5

Browse files
committed
Merge branch 'master' into issue/36307
2 parents 9786534 + de5b418 commit f0ff6c5

File tree

105 files changed

+2568
-759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2568
-759
lines changed

doc/go1.22.html

+54-25
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,26 @@ <h3 id="vet">Vet</h3>
8383

8484
<h2 id="runtime">Runtime</h2>
8585

86-
<p>
87-
TODO: complete this section, or delete if not needed
86+
<p><!-- CL 543255 -->
87+
The runtime now keeps type-based garbage collection metadata nearer to each
88+
heap object, improving the CPU performance (latency or throughput) of Go programs
89+
by 1&mdash;3%.
90+
This change also reduces the memory overhead of the majority Go programs by
91+
approximately 1% by deduplicating redundant metadata.
92+
Some programs may see a smaller improvement because this change adjusts the size
93+
class boundaries of the memory allocator, so some objects may be moved up a size
94+
class.
95+
<br />
96+
A consequence of this change is that some objects' addresses that were previously
97+
always aligned to a 16 byte (or higher) boundary will now only be aligned to an 8
98+
byte boundary.
99+
Some programs that use assembly instructions that require memory addresses to be
100+
more than 8-byte aligned and rely on the memory allocator's previous alignment behavior
101+
may break, but we expect such programs to be rare.
102+
Such programs may be built with <code>GOEXPERIMENT=noallocheaders</code> to revert
103+
to the old metadata layout and restore the previous alignment behavior, but package
104+
owners should update their assembly code to avoid the alignment assumption, as this
105+
workaround will be removed in a future release.
88106
</p>
89107

90108
<h2 id="compiler">Compiler</h2>
@@ -108,6 +126,14 @@ <h2 id="linker">Linker</h2>
108126
TODO: complete this section, or delete if not needed
109127
</p>
110128

129+
<h2 id="bootstrap">Bootstrap</h2>
130+
131+
<p>
132+
As mentioned in the <a href="/doc/go1.20#bootstrap">Go 1.20 release notes</a>, Go 1.22 now requires
133+
the final point release of Go 1.20 or later for bootstrap.
134+
We expect that Go 1.24 will require the final point release of Go 1.22 or later for bootstrap.
135+
</p>
136+
111137
<h2 id="library">Core library</h2>
112138

113139
<h3 id="minor_library_changes">New math/rand/v2 package</h3>
@@ -294,14 +320,6 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
294320
</dd>
295321
</dl><!-- encoding -->
296322

297-
<dl id="encoding/binary"><dt><a href="/pkg/encoding/binary/">encoding/binary</a></dt>
298-
<dd>
299-
<p><!-- https://go.dev/issue/57237 -->
300-
TODO: <a href="https://go.dev/issue/57237">https://go.dev/issue/57237</a>: add var NativeEndian; also x/sys/cpu.IsBigEndian
301-
</p>
302-
</dd>
303-
</dl><!-- encoding/binary -->
304-
305323
<dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
306324
<dd>
307325
<p><!-- https://go.dev/issue/52463 -->
@@ -486,6 +504,18 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
486504
</dd>
487505
</dl><!-- os/exec -->
488506

507+
<dl id="go/types"><dt><a href="/pkg/go/types/">go/types</a></dt>
508+
<dd>
509+
<p><!-- https://go.dev/issue/64295, CL 544035 -->
510+
The start position (<a href="/pkg/go/types#Scope.Pos">Pos</a>)
511+
of the lexical environment block (<a href="/pkg/go/types#Scope">Scope</a>)
512+
that represents a function body has changed:
513+
it used to start at the opening curly brace of the function body,
514+
but now starts at the function's <code>func</code> token.
515+
</p>
516+
</dd>
517+
</dl>
518+
489519
<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
490520
<dd>
491521
<p><!-- https://go.dev/issue/61827, CL 517777 -->
@@ -505,10 +535,6 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
505535
<p><!-- https://go.dev/issue/61015 -->
506536
TODO: <a href="https://go.dev/issue/61015">https://go.dev/issue/61015</a>: change mutex profile to scale contention by number of blocked goroutines
507537
</p>
508-
509-
<p><!-- CL 543255 -->
510-
TODO: <a href="https://go.dev/cl/543255">https://go.dev/cl/543255</a>: runtime: put allocation headers back at the start the object
511-
</p>
512538
</dd>
513539
</dl><!-- runtime -->
514540

@@ -522,20 +548,16 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
522548

523549
<dl id="slices"><dt><a href="/pkg/slices/">slices</a></dt>
524550
<dd>
525-
<p><!-- https://go.dev/issue/56353 -->
526-
TODO: <a href="https://go.dev/issue/56353">https://go.dev/issue/56353</a>: add Concat
527-
</p>
528-
529-
<p><!-- https://go.dev/issue/63393 -->
530-
TODO: <a href="https://go.dev/issue/63393">https://go.dev/issue/63393</a>: have Delete and others clear the tail
551+
<p><!-- https://go.dev/issue/56353 --><!-- CL 504882 -->
552+
The new function <code>Concat</code> concatenates multiple slices.
531553
</p>
532554

533-
<p><!-- CL 504882 -->
534-
TODO: <a href="https://go.dev/cl/504882">https://go.dev/cl/504882</a>: slices: add Concat
555+
<p><!-- https://go.dev/issue/63393 --><!-- CL 543335 -->
556+
Functions that shrink the size of a slice (<code>Delete</code>, <code>DeleteFunc</code>, <code>Compact</code>, <code>CompactFunc</code>, and <code>Replace</code>) now zero the elements between the new length and the old length.
535557
</p>
536558

537-
<p><!-- CL 540155 -->
538-
TODO: <a href="https://go.dev/cl/540155">https://go.dev/cl/540155</a>: slices: make Insert panic if index is out of range and there are no values
559+
<p><!-- https://go.dev/issue/63913 --><!-- CL 540155 -->
560+
<code>Insert</code> now always panics if the argument <code>i</code> is out of range. Previously it did not panic in this situation if there were no elements to be inserted.
539561
</p>
540562
</dd>
541563
</dl><!-- slices -->
@@ -570,8 +592,15 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
570592

571593
<h2 id="ports">Ports</h2>
572594

595+
<h3 id="arm">Arm</h3>
573596
<p><!-- CL 514907 -->
574-
TODO: <a href="https://go.dev/cl/514907">https://go.dev/cl/514907</a>: all: add floating point option for ARM targets
597+
The <code>GOARM</code> environment variable now allows you to select whether to use software or hardware floating point.
598+
Previously, valid <code>GOARM</code> values were <code>5</code>, <code>6</code>, or <code>7</code>. Now those same values can
599+
be optionally followed by <code>,softfloat</code> or <code>,hardfloat</code> to select the floating-point implementation.
600+
</p>
601+
<p>
602+
This new option defaults to <code>softfloat</code> for version <code>5</code> and <code>hardfloat</code> for versions
603+
<code>6</code> and <code>7</code>.
575604
</p>
576605

577606
<p><!-- CL 481315 -->

src/bytes/boundary_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,18 @@ func TestIndexNearPageBoundary(t *testing.T) {
9898
}
9999
q[len(q)-1] = 0
100100
}
101+
102+
func TestCountNearPageBoundary(t *testing.T) {
103+
t.Parallel()
104+
b := dangerousSlice(t)
105+
for i := range b {
106+
c := Count(b[i:], []byte{1})
107+
if c != 0 {
108+
t.Fatalf("Count(b[%d:], {1})=%d, want 0\n", i, c)
109+
}
110+
c = Count(b[:i], []byte{0})
111+
if c != i {
112+
t.Fatalf("Count(b[:%d], {0})=%d, want %d\n", i, c, i)
113+
}
114+
}
115+
}

src/cmd/cgo/internal/test/callback_windows.go

+7-31
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ USHORT backtrace(ULONG FramesToCapture, PVOID *BackTrace) {
2929
}
3030
3131
ControlPc = context.Rip;
32-
// Check if we left the user range.
32+
// Check if we left the user range.
3333
if (ControlPc < 0x10000) {
3434
break;
3535
}
@@ -65,32 +65,17 @@ func testCallbackCallersSEH(t *testing.T) {
6565
// TODO: support SEH on other architectures.
6666
t.Skip("skipping on non-amd64")
6767
}
68-
const cgoexpPrefix = "_cgoexp_"
68+
// Only frames in the test package are checked.
6969
want := []string{
70-
"runtime.asmcgocall_landingpad",
71-
"runtime.asmcgocall",
72-
"runtime.cgocall",
7370
"test._Cfunc_backtrace",
7471
"test.testCallbackCallersSEH.func1.1",
7572
"test.testCallbackCallersSEH.func1",
7673
"test.goCallback",
77-
cgoexpPrefix + "goCallback",
78-
"runtime.cgocallbackg1",
79-
"runtime.cgocallbackg",
80-
"runtime.cgocallbackg",
81-
"runtime.cgocallback",
82-
"crosscall2",
83-
"runtime.asmcgocall_landingpad",
84-
"runtime.asmcgocall",
85-
"runtime.cgocall",
8674
"test._Cfunc_callback",
8775
"test.nestedCall.func1",
8876
"test.nestedCall",
8977
"test.testCallbackCallersSEH",
9078
"test.TestCallbackCallersSEH",
91-
"testing.tRunner",
92-
"testing.(*T).Run.gowrap1",
93-
"runtime.goexit",
9479
}
9580
pc := make([]uintptr, 100)
9681
n := 0
@@ -105,26 +90,17 @@ func testCallbackCallersSEH(t *testing.T) {
10590
}
10691
fname := f.Name()
10792
switch fname {
108-
case "goCallback", "callback":
109-
// TODO(qmuntal): investigate why these functions don't appear
93+
case "goCallback":
94+
// TODO(qmuntal): investigate why this function doesn't appear
11095
// when using the external linker.
11196
continue
11297
}
113-
// Skip cgo-generated functions, the runtime might not know about them,
114-
// depending on the link mode.
115-
if strings.HasPrefix(fname, "_cgo_") {
116-
continue
117-
}
118-
// Remove the cgo-generated random prefix.
119-
if strings.HasPrefix(fname, cgoexpPrefix) {
120-
idx := strings.Index(fname[len(cgoexpPrefix):], "_")
121-
if idx >= 0 {
122-
fname = cgoexpPrefix + fname[len(cgoexpPrefix)+idx+1:]
123-
}
124-
}
12598
// In module mode, this package has a fully-qualified import path.
12699
// Remove it if present.
127100
fname = strings.TrimPrefix(fname, "cmd/cgo/internal/")
101+
if !strings.HasPrefix(fname, "test.") {
102+
continue
103+
}
128104
got = append(got, fname)
129105
}
130106
if !reflect.DeepEqual(want, got) {

src/cmd/compile/internal/noder/helpers.go

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ func idealType(tv syntax.TypeAndValue) types2.Type {
9999
typ = types2.Typ[types2.Bool] // expression in "if" or "for" condition
100100
case types2.UntypedString:
101101
typ = types2.Typ[types2.String] // argument to "append" or "copy" calls
102+
case types2.UntypedRune:
103+
typ = types2.Typ[types2.Int32] // range over rune
102104
default:
103105
return nil
104106
}

0 commit comments

Comments
 (0)