re PR go/83787 (Many 32-bit Solaris/SPARC Go tests FAIL after Go1.10beta1 update)
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 18 Jan 2018 04:24:48 +0000 (04:24 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 18 Jan 2018 04:24:48 +0000 (04:24 +0000)
PR go/83787
    compiler: pass int to makechan, call makechan64 when appropriate

    The update to 1.10beta1 changed makechan to take int instead of int64,
    and added a makechan64 call for large values.  Since the size is the
    last argument to makechan, the old compiler which always passed a
    64-bit int worked fine on 64-bit systems and little-endian 32-bit
    systems, but broke on big-endian 32-bit systems.  This CL fixes the
    compiler to use the appropriate types.

    This fixes GCC PR 83787.

    Reviewed-on: https://go-review.googlesource.com/88077

From-SVN: r256835

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/escape.cc
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/runtime.def
libgo/go/runtime/chan.go

index e7b959f850e5375b24cf4b48840d1d0aae8621b9..93e7215271e3c70516cf72b720d24770739422ed 100644 (file)
@@ -1,4 +1,4 @@
-1072286ca9249bd6f75628aead325a66286bcf5b
+925635f067d40d30acf565b620cc859ee7cbc990
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 7bab3cbdd4a82bb0a81fa51f9e197f26da26518d..4f95945e230988615373f3a55d1462061391c786 100644 (file)
@@ -360,6 +360,7 @@ Node::op_format() const
                  break;
 
                case Runtime::MAKECHAN:
+               case Runtime::MAKECHAN64:
                case Runtime::MAKEMAP:
                case Runtime::MAKESLICE:
                case Runtime::MAKESLICE64:
@@ -1602,6 +1603,7 @@ Escape_analysis_assign::expression(Expression** pexpr)
            switch (fe->runtime_code())
              {
              case Runtime::MAKECHAN:
+             case Runtime::MAKECHAN64:
              case Runtime::MAKEMAP:
              case Runtime::MAKESLICE:
              case Runtime::MAKESLICE64:
@@ -2284,6 +2286,7 @@ Escape_analysis_assign::assign(Node* dst, Node* src)
                switch (fe->runtime_code())
                  {
                  case Runtime::MAKECHAN:
+                 case Runtime::MAKECHAN64:
                  case Runtime::MAKEMAP:
                  case Runtime::MAKESLICE:
                  case Runtime::MAKESLICE64:
@@ -3056,6 +3059,7 @@ Escape_analysis_flood::flood(Level level, Node* dst, Node* src,
               switch (call->fn()->func_expression()->runtime_code())
                 {
                 case Runtime::MAKECHAN:
+               case Runtime::MAKECHAN64:
                 case Runtime::MAKEMAP:
                 case Runtime::MAKESLICE:
                 case Runtime::MAKESLICE64:
index 99fb1b59adee06df9207b5dd402be778c693a6ca..47be82f823ec591abf92a22b1b9a053ec2e8954f 100644 (file)
@@ -7565,7 +7565,10 @@ Builtin_call_expression::lower_make(Statement_inserter* inserter)
   else if (is_chan)
     {
       Expression* type_arg = Expression::make_type_descriptor(type, type_loc);
-      call = Runtime::make_call(Runtime::MAKECHAN, loc, 2, type_arg, len_arg);
+      Runtime::Function code = Runtime::MAKECHAN;
+      if (!len_small)
+       code = Runtime::MAKECHAN64;
+      call = Runtime::make_call(code, loc, 2, type_arg, len_arg);
     }
   else
     go_unreachable();
index 605bcff4a0f1921112fba6f677dd4ef91da8b3a8..fdb159e55057d4a444f22f81437c4f754d42d04d 100644 (file)
@@ -139,7 +139,8 @@ DEF_GO_RUNTIME(MAPITERNEXT, "runtime.mapiternext", P1(POINTER), R0())
 
 
 // Make a channel.
-DEF_GO_RUNTIME(MAKECHAN, "runtime.makechan", P2(TYPE, INT64), R1(CHAN))
+DEF_GO_RUNTIME(MAKECHAN, "runtime.makechan", P2(TYPE, INT), R1(CHAN))
+DEF_GO_RUNTIME(MAKECHAN64, "runtime.makechan64", P2(TYPE, INT64), R1(CHAN))
 
 // Send a value on a channel.
 DEF_GO_RUNTIME(CHANSEND, "runtime.chansend1", P2(CHAN, POINTER), R0())
index 8db728d5430c29e7f040fa86d5788b9dcdffd725..bf708aec5c439faab1230a334a802339c9151245 100644 (file)
@@ -26,6 +26,7 @@ import (
 // themselves, so that the compiler will export them.
 //
 //go:linkname makechan runtime.makechan
+//go:linkname makechan64 runtime.makechan64
 //go:linkname chansend1 runtime.chansend1
 //go:linkname chanrecv1 runtime.chanrecv1
 //go:linkname chanrecv2 runtime.chanrecv2