diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-08-28 20:39:32 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-08-28 20:39:32 +0000 |
commit | 32b1d51f16fe56b34e979fcfba4bc74dbd3592a9 (patch) | |
tree | cd54b1786061eb18e64ce26e6392df3096b5ba35 /libgo/go/runtime/malloc.go | |
parent | c980510a5ab79614fcbaf5f411b1273dc9a8c7ca (diff) | |
download | gcc-32b1d51f16fe56b34e979fcfba4bc74dbd3592a9.zip gcc-32b1d51f16fe56b34e979fcfba4bc74dbd3592a9.tar.gz gcc-32b1d51f16fe56b34e979fcfba4bc74dbd3592a9.tar.bz2 |
runtime: move osinit to Go
This is a step toward updating libgo to 1.13. This adds the 1.13
version of the osinit function to Go code, and removes the
corresponding code from the C runtime. This should simplify future updates.
Some additional 1.13 code was brought in to simplify this change.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191717
From-SVN: r275010
Diffstat (limited to 'libgo/go/runtime/malloc.go')
-rw-r--r-- | libgo/go/runtime/malloc.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libgo/go/runtime/malloc.go b/libgo/go/runtime/malloc.go index c0b4caa..68e5494 100644 --- a/libgo/go/runtime/malloc.go +++ b/libgo/go/runtime/malloc.go @@ -335,6 +335,23 @@ const ( // mallocinit. var physPageSize uintptr +// physHugePageSize is the size in bytes of the OS's default physical huge +// page size whose allocation is opaque to the application. It is assumed +// and verified to be a power of two. +// +// If set, this must be set by the OS init code (typically in osinit) before +// mallocinit. However, setting it at all is optional, and leaving the default +// value is always safe (though potentially less efficient). +// +// Since physHugePageSize is always assumed to be a power of two, +// physHugePageShift is defined as physHugePageSize == 1 << physHugePageShift. +// The purpose of physHugePageShift is to avoid doing divisions in +// performance critical functions. +var ( + physHugePageSize uintptr + physHugePageShift uint +) + // OS-defined helpers: // // sysAlloc obtains a large chunk of zeroed memory from the |