libgo patch committed: rewrite lfstack to look more like gc code

Ian Lance Taylor iant@golang.org
Thu Sep 24 13:39:00 GMT 2015


On Thu, Sep 24, 2015 at 6:25 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Ian Lance Taylor <iant@golang.org> writes:
>
>> This patch by Michael Hudson-Doyle rewrites the lfstack code in libgo
>> to look more like that in the gc library.  It also fixes it for arm64.
>> Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
>> Committed to mainline.
>
> This patch broke Solaris/x86 bootstrap: the amd64 lfstack.goc fails to
> compile:
>
> $ /bin/ksh ./libtool --tag=CC   --mode=compile /var/gcc/gcc-6.0.0-20150924/12-gcc/./gcc/xgcc -B/var/gcc/gcc-6.0.0-20150924/12-gcc/./gcc/ -B/usr/local/i386-pc-solaris2.12/bin/ -B/usr/local/i386-pc-solaris2.12/lib/ -isystem /usr/local/i386-pc-solaris2.12/include -isystem /usr/local/i386-pc-solaris2.12/sys-include  -m64 -DHAVE_CONFIG_H -I. -I/vol/gcc/src/hg/trunk/solaris/libgo  -I /vol/gcc/src/hg/trunk/solaris/libgo/runtime -I/vol/gcc/src/hg/trunk/solaris/libgo/../libffi/include -I../libffi/include -pthread  -fexceptions -fnon-call-exceptions -fplan9-extensions  -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror -minline-all-stringops -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I /vol/gcc/src/hg/trunk/solaris/libgo/../libgcc -I /vol/gcc/src/hg/trunk/solaris/libgo/../libbacktrace -I ../../../gcc/include -g -O2 -MT lfstack.lo -MD -MP -MF .deps/lfstack.Tpo -c -o lfstack.lo lfstack.c
> libtool: compile:  /var/gcc/gcc-6.0.0-20150924/12-gcc/./gcc/xgcc -B/var/gcc/gcc-6.0.0-20150924/12-gcc/./gcc/ -B/usr/local/i386-pc-solaris2.12/bin/ -B/usr/local/i386-pc-solaris2.12/lib/ -isystem /usr/local/i386-pc-solaris2.12/include -isystem /usr/local/i386-pc-solaris2.12/sys-include -m64 -DHAVE_CONFIG_H -I. -I/vol/gcc/src/hg/trunk/solaris/libgo -I /vol/gcc/src/hg/trunk/solaris/libgo/runtime -I/vol/gcc/src/hg/trunk/solaris/libgo/../libffi/include -I../libffi/include -pthread -fexceptions -fnon-call-exceptions -fplan9-extensions -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror -minline-all-stringops -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I /vol/gcc/src/hg/trunk/solaris/libgo/../libgcc -I /vol/gcc/src/hg/trunk/solaris/libgo/../libbacktrace -I ../../../gcc/include -g -O2 -MT lfstack.lo -MD -MP -MF .deps/lfstack.Tpo -c lfstack.c  -fPIC -DPIC -o .libs/lfstack.o
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:32:22: error: redefinition of 'lfPack'
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:16:22: note: previous definition of 'lfPack' was here
>  static inline uint64 lfPack(LFNode *node, uintptr cnt) {
>                       ^
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc: In function 'lfPack':
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:33:38: error: 'PTR_BITS' undeclared (first use in this function)
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:33:38: note: each undeclared identifier is reported only once for each function it appears in
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc: At top level:
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:35:23: error: redefinition of 'lfUnpack'
>   return ((uint64)(node)<<(64-PTR_BITS)) | (cnt&(((1<<CNT_BITS)-1)));
>                        ^
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:19:23: note: previous definition of 'lfUnpack' was here
>  static inline LFNode* lfUnpack(uint64 val) {
>                        ^
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc: In function 'lfUnpack':
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:31:26: error: 'PTR_BITS' undeclared (first use in this function)
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:36:31: note: in expansion of macro 'CNT_BITS'
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc: In function 'lfPack':
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:34:1: error: control reaches end of non-void function [-Werror=return-type]
>  static inline uint64 lfPack(LFNode *node, uintptr cnt) {
>  ^
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc: In function 'lfUnpack':
> /vol/gcc/src/hg/trunk/solaris/libgo/runtime/lfstack.goc:37:1: error: control reaches end of non-void function [-Werror=return-type]
>  static inline LFNode* lfUnpack(uint64 val) {
>  ^
> cc1: all warnings being treated as errors
> make: *** [lfstack.lo] Error 1

Bother.  Sorry about that.  Should be fixed with this patch.
Committed to mainline.

Ian
-------------- next part --------------
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 228064)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-90ebe729992443dc00b19c76b28d1270e17245a4
+66c113f1af300ce27b99f18f792901d7327d6699
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/runtime/lfstack.goc
===================================================================
--- libgo/runtime/lfstack.goc	(revision 228057)
+++ libgo/runtime/lfstack.goc	(working copy)
@@ -29,7 +29,6 @@ static inline LFNode* lfUnpack(uint64 va
 // So we use 17msb of pointers as ABA counter.
 #   define PTR_BITS 47
 #  endif
-# endif
 # define CNT_BITS (64 - PTR_BITS + 3)
 static inline uint64 lfPack(LFNode *node, uintptr cnt) {
 	return ((uint64)(node)<<(64-PTR_BITS)) | (cnt&(((1<<CNT_BITS)-1)));
@@ -37,6 +36,7 @@ static inline uint64 lfPack(LFNode *node
 static inline LFNode* lfUnpack(uint64 val) {
 	return (LFNode*)((val >> CNT_BITS) << 3);
 }
+# endif
 #else
 static inline uint64 lfPack(LFNode *node, uintptr cnt) {
 	return ((uint64)(uintptr)(node)<<32) | cnt;


More information about the Gcc-patches mailing list