public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: vladimir.mezentsev@oracle.com
Cc: "gofrontend-dev@googlegroups.com"
	<gofrontend-dev@googlegroups.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [gofrontend-dev] [PATCH] Porting gccgo on sparc64-linux
Date: Wed, 31 May 2017 22:33:00 -0000	[thread overview]
Message-ID: <CAOyqgcWseKoQ_=7-+YEXmN5+9SNy6HNj3bS7duvpnPW0hyhpLw@mail.gmail.com> (raw)
In-Reply-To: <1496263174-31361-1-git-send-email-vladimir.mezentsev@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

On Wed, May 31, 2017 at 1:39 PM,  <vladimir.mezentsev@oracle.com> wrote:
> From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
>
> Tested on sparc64-linux-gnu. 7243 tests passed
>
> 2017-05-31  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
>
> * libgo/go/runtime/lfstack_64bit.go (lfstackPack, lfstackUnpack): Handle sparc64-linux
> * libgo/mkrsysinfo.sh (epollevent structure): Set alignment 8 on sparc64-linux

Thanks.  Committed as follows.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3094 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 248528)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-884df09c3da0f39309ab13f2ad401628fb933050
+e5870eac67d4d5b1f86bdbfb13dadf4d5723f71d
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/Makefile.am
===================================================================
--- libgo/Makefile.am	(revision 248168)
+++ libgo/Makefile.am	(working copy)
@@ -531,7 +531,7 @@ s-version: Makefile
 
 runtime_sysinfo.go: s-runtime_sysinfo; @true
 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
-	GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
+	GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
 	$(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
 	$(STAMP) $@
 
Index: libgo/go/runtime/lfstack_64bit.go
===================================================================
--- libgo/go/runtime/lfstack_64bit.go	(revision 247837)
+++ libgo/go/runtime/lfstack_64bit.go	(working copy)
@@ -32,9 +32,18 @@ const (
 	// bottom, because node must be pointer-aligned, giving a total of 19 bits
 	// of count.
 	cntBits = 64 - addrBits + 3
+
+	// On sparc64-linux, user addresses are 52-bit numbers sign extended to 64.
+	// We shift the address left 12 to eliminate the sign extended part and make
+	// room in the bottom for the count.
+	sparcLinuxAddrBits = 52
+	sparcLinuxCntBits  = 64 - sparcLinuxAddrBits + 3
 )
 
 func lfstackPack(node *lfnode, cnt uintptr) uint64 {
+	if GOARCH == "sparc64" && GOOS == "linux" {
+		return uint64(uintptr(unsafe.Pointer(node)))<<(64-sparcLinuxAddrBits) | uint64(cnt&(1<<sparcLinuxCntBits-1))
+	}
 	return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1))
 }
 
@@ -44,5 +53,8 @@ func lfstackUnpack(val uint64) *lfnode {
 		// val before unpacking.
 		return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> cntBits << 3)))
 	}
+	if GOARCH == "sparc64" && GOOS == "linux" {
+		return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3)))
+	}
 	return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3)))
 }
Index: libgo/mkrsysinfo.sh
===================================================================
--- libgo/mkrsysinfo.sh	(revision 247848)
+++ libgo/mkrsysinfo.sh	(working copy)
@@ -83,7 +83,11 @@ if grep '^const _epoll_data_offset ' ${O
   if test "$val" = "4"; then
       echo 'type epollevent struct { events uint32; data [8]byte }' >> ${OUT}
   elif test "$val" = "8"; then
-      echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte }' >> ${OUT}
+      if test "$GOARCH" = "sparc64" -a "$GOOS" = "linux"; then
+          echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte; _align [0]int64 }' >> ${OUT}
+      else
+          echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte }' >> ${OUT}
+      fi
   else
       echo 1>&2 "unknown epoll data offset value ${val}"
       exit 1

           reply	other threads:[~2017-05-31 21:36 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1496263174-31361-1-git-send-email-vladimir.mezentsev@oracle.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOyqgcWseKoQ_=7-+YEXmN5+9SNy6HNj3bS7duvpnPW0hyhpLw@mail.gmail.com' \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    --cc=vladimir.mezentsev@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).