Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.20.x
go-version: 1.23.x
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/go/bin
Expand All @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.20.x
go-version: 1.23.x
- run: go install golang.org/dl/gotip@latest
- run: gotip download
- run: gotip version
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module github.com/orijtech/structslop

go 1.20
go 1.23.0

toolchain go1.24.6

require (
github.com/dave/dst v0.27.2
golang.org/x/tools v0.8.0
golang.org/x/tools v0.36.0
)

require (
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/mod v0.27.0 // indirect
golang.org/x/sync v0.16.0 // indirect
)
17 changes: 10 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
github.com/dave/dst v0.27.2 h1:4Y5VFTkhGLC1oddtNwuxxe36pnyLxMFXT51FOzH8Ekc=
github.com/dave/dst v0.27.2/go.mod h1:jHh6EOibnHgcUW3WjKHisiooEkYwqpHLBSX1iOBhEyc=
github.com/dave/jennifer v1.5.0 h1:HmgPN93bVDpkQyYbqhCHj5QlgvUkvEOzMyEvKLgCRrg=
github.com/dave/jennifer v1.5.0/go.mod h1:4MnyiFIlZS3l5tSDn8VnzE6ffAhYBMB2SZntBsZGUok=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
27 changes: 27 additions & 0 deletions internal/runtime/gc/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2009 The Go Authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 changes: 14 additions & 0 deletions internal/runtime/gc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Original Source
This code is a fork of the internal/runtime/gc package from the official Go programming language repository.

Original Repository: https://go.googlesource.com/go

# License
The original source code of the Go project is licensed under a BSD-style license. The terms of this license permit redistribution and use in source and binary forms, with or without modification, provided that certain conditions are met, including retaining the copyright notice and disclaimer.

All modifications and additions made in this repository are also subject to the same BSD-style license.

A copy of the full license text can be found in the LICENSE file within this repository.

# Disclaimer
This project is provided "as is," without warranty of any kind. Use at your own risk.
50 changes: 50 additions & 0 deletions internal/runtime/gc/malloc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2025 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.

package gc

const (
ptrBits = 8 * PtrSize

// A malloc header is functionally a single type pointer, but
// we need to use 8 here to ensure 8-byte alignment of allocations
// on 32-bit platforms. It's wasteful, but a lot of code relies on
// 8-byte alignment for 8-byte atomics.
MallocHeaderSize = 8

// The minimum object size that has a malloc header, exclusive.
//
// The size of this value controls overheads from the malloc header.
// The minimum size is bound by writeHeapBitsSmall, which assumes that the
// pointer bitmap for objects of a size smaller than this doesn't cross
// more than one pointer-word boundary. This sets an upper-bound on this
// value at the number of bits in a uintptr, multiplied by the pointer
// size in bytes.
//
// We choose a value here that has a natural cutover point in terms of memory
// overheads. This value just happens to be the maximum possible value this
// can be.
//
// A span with heap bits in it will have 128 bytes of heap bits on 64-bit
// platforms, and 256 bytes of heap bits on 32-bit platforms. The first size
// class where malloc headers match this overhead for 64-bit platforms is
// 512 bytes (8 KiB / 512 bytes * 8 bytes-per-header = 128 bytes of overhead).
// On 32-bit platforms, this same point is the 256 byte size class
// (8 KiB / 256 bytes * 8 bytes-per-header = 256 bytes of overhead).
//
// Guaranteed to be exactly at a size class boundary. The reason this value is
// an exclusive minimum is subtle. Suppose we're allocating a 504-byte object
// and its rounded up to 512 bytes for the size class. If minSizeForMallocHeader
// is 512 and an inclusive minimum, then a comparison against minSizeForMallocHeader
// by the two values would produce different results. In other words, the comparison
// would not be invariant to size-class rounding. Eschewing this property means a
// more complex check or possibly storing additional state to determine whether a
// span has malloc headers.
MinSizeForMallocHeader = PtrSize * ptrBits

// PageSize is the increment in which spans are managed.
PageSize = 1 << PageShift

PtrSize = 4 << (^uintptr(0) >> 63)
)
Loading
Loading