From: Ian Lance Taylor Date: Tue, 29 Aug 2017 18:59:04 +0000 (+0000) Subject: runtime: fix lfstack for 64-bit AIX X-Git-Tag: upstream/12.2.0~37465 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2aa807ef9537ab75e81dd0470e90f5a54d75031;p=platform%2Fupstream%2Fgcc.git runtime: fix lfstack for 64-bit AIX Reviewed-on: https://go-review.googlesource.com/57550 From-SVN: r251420 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 938866a..3d20e71 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2c4a2bd826e58c8c8c51b9196c8d2c67abc4037e +db8e3801bf8508656606d6e465c76cdc6e9a9eb7 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go index 3d5588d..44cbf74 100644 --- a/libgo/go/runtime/lfstack_64bit.go +++ b/libgo/go/runtime/lfstack_64bit.go @@ -43,6 +43,14 @@ const ( // 52 address bits each (with 64k page size). ia64AddrBits = 55 ia64CntBits = 64 - ia64AddrBits + 3 + + // On AIX, 64-bit addresses are split into 36-bit segment number and 28-bit + // offset in segment. Segment numbers in the range 0x070000000-0x07FFFFFFF + // and 0x0A0000000-0x0AFFFFFFF(LSA) are available for mmap. + // We assume all lfnode addresses are from memory allocated with mmap. + // We use one bit to distinguish between the two ranges. + aixAddrBits = 57 + aixCntBits = 64 - aixAddrBits + 3 ) func lfstackPack(node *lfnode, cnt uintptr) uint64 { @@ -54,6 +62,9 @@ func lfstackPack(node *lfnode, cnt uintptr) uint64 { val := uint64(uintptr(unsafe.Pointer(node))) return (val<<(64-ia64AddrBits))&(1<<(64-3)-1) | val&^(1<<(64-3)-1) | uint64(cnt&(1<>ia64CntBits<<3)&(1<<(64-3)-1) | val&^(1<<(64-3)-1)))) } + if GOARCH == "ppc64" && GOOS == "aix" { + if val&(1<<63) != 0 { + return (*lfnode)(unsafe.Pointer(uintptr((val >> aixCntBits << 3) | 0x7<<56))) + } else { + return (*lfnode)(unsafe.Pointer(uintptr((val >> aixCntBits << 3) | 0xa<<56))) + } + } return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3))) }