Skip to content

Commit e7a4789

Browse files
authored
Merge branch 'golang:master' into master
2 parents 1ba8596 + 98a0311 commit e7a4789

File tree

27 files changed

+263
-47
lines changed

27 files changed

+263
-47
lines changed

doc/next/1-intro.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<style>
2+
main ul li { margin: 0.5em 0; }
3+
</style>
4+
5+
## DRAFT RELEASE NOTES — Introduction to Go 1.26 {#introduction}
6+
7+
**Go 1.26 is not yet released. These are work-in-progress release notes.
8+
Go 1.26 is expected to be released in February 2026.**

doc/next/2-language.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Changes to the language {#language}
2+
3+

doc/next/3-tools.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Tools {#tools}
2+
3+
### Go command {#go-command}
4+
5+
### Cgo {#cgo}
6+

doc/next/4-runtime.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Runtime {#runtime}

doc/next/5-toolchain.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Compiler {#compiler}
2+
3+
## Assembler {#assembler}
4+
5+
## Linker {#linker}
6+
7+

doc/next/6-stdlib/0-heading.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Standard library {#library}
2+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### Minor changes to the library {#minor_library_changes}
2+
3+
#### go/types
4+
5+
The `Var.Kind` method returns an enumeration of type `VarKind` that
6+
classifies the variable (package-level, local, receiver, parameter,
7+
result, or struct field). See issue #70250.
8+
9+
Callers of `NewVar` or `NewParam` are encouraged to call `Var.SetKind`
10+
to ensure that this attribute is set correctly in all cases.

doc/next/6-stdlib/99-minor/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API changes and other small changes to the standard library go here.

doc/next/7-ports.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Ports {#ports}
2+

src/cmd/compile/internal/dwarfgen/dwarf.go

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,6 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
248248
if n.Class == ir.PPARAM || n.Class == ir.PPARAMOUT {
249249
tag = dwarf.DW_TAG_formal_parameter
250250
}
251-
if n.Esc() == ir.EscHeap {
252-
// The variable in question has been promoted to the heap.
253-
// Its address is in n.Heapaddr.
254-
// TODO(thanm): generate a better location expression
255-
}
256251
inlIndex := 0
257252
if base.Flag.GenDwarfInl > 1 {
258253
if n.InlFormal() || n.InlLocal() {
@@ -263,7 +258,7 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
263258
}
264259
}
265260
declpos := base.Ctxt.InnermostPos(n.Pos())
266-
vars = append(vars, &dwarf.Var{
261+
dvar := &dwarf.Var{
267262
Name: n.Sym().Name,
268263
IsReturnValue: isReturnValue,
269264
Tag: tag,
@@ -277,8 +272,19 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
277272
ChildIndex: -1,
278273
DictIndex: n.DictIndex,
279274
ClosureOffset: closureOffset(n, closureVars),
280-
})
281-
// Record go type of to insure that it gets emitted by the linker.
275+
}
276+
if n.Esc() == ir.EscHeap {
277+
if n.Heapaddr == nil {
278+
base.Fatalf("invalid heap allocated var without Heapaddr")
279+
}
280+
debug := fn.DebugInfo.(*ssa.FuncDebug)
281+
list := createHeapDerefLocationList(n, debug.EntryID)
282+
dvar.PutLocationList = func(listSym, startPC dwarf.Sym) {
283+
debug.PutLocationList(list, base.Ctxt, listSym.(*obj.LSym), startPC.(*obj.LSym))
284+
}
285+
}
286+
vars = append(vars, dvar)
287+
// Record go type to ensure that it gets emitted by the linker.
282288
fnsym.Func().RecordAutoType(reflectdata.TypeLinksym(n.Type()))
283289
}
284290

@@ -550,6 +556,29 @@ func createComplexVar(fnsym *obj.LSym, fn *ir.Func, varID ssa.VarID, closureVars
550556
return dvar
551557
}
552558

559+
// createHeapDerefLocationList creates a location list for a heap-escaped variable
560+
// that describes "dereference pointer at stack offset"
561+
func createHeapDerefLocationList(n *ir.Name, entryID ssa.ID) []byte {
562+
// Get the stack offset where the heap pointer is stored
563+
heapPtrOffset := n.Heapaddr.FrameOffset()
564+
if base.Ctxt.Arch.FixedFrameSize == 0 {
565+
heapPtrOffset -= int64(types.PtrSize)
566+
}
567+
if buildcfg.FramePointerEnabled {
568+
heapPtrOffset -= int64(types.PtrSize)
569+
}
570+
571+
// Create a location expression: DW_OP_fbreg <offset> DW_OP_deref
572+
var locExpr []byte
573+
var sizeIdx int
574+
locExpr, sizeIdx = ssa.SetupLocList(base.Ctxt, entryID, locExpr, ssa.BlockStart.ID, ssa.FuncEnd.ID)
575+
locExpr = append(locExpr, dwarf.DW_OP_fbreg)
576+
locExpr = dwarf.AppendSleb128(locExpr, heapPtrOffset)
577+
locExpr = append(locExpr, dwarf.DW_OP_deref)
578+
base.Ctxt.Arch.ByteOrder.PutUint16(locExpr[sizeIdx:], uint16(len(locExpr)-sizeIdx-2))
579+
return locExpr
580+
}
581+
553582
// RecordFlags records the specified command-line flags to be placed
554583
// in the DWARF info.
555584
func RecordFlags(flags ...string) {

0 commit comments

Comments
 (0)