compiler, libgo: Fixes to prepare for 64-bit int.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 6 Nov 2012 18:28:21 +0000 (18:28 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 6 Nov 2012 18:28:21 +0000 (18:28 +0000)
From-SVN: r193254

12 files changed:
gcc/go/gofrontend/types.cc
libgo/go/bytes/indexbyte.c
libgo/go/log/syslog/syslog_c.c
libgo/go/syscall/signame.c
libgo/runtime/cpuprof.c
libgo/runtime/go-new-map.c
libgo/runtime/go-rune.c
libgo/runtime/go-string.h
libgo/runtime/go-traceback.c
libgo/runtime/proc.c
libgo/runtime/runtime.h
libgo/runtime/string.goc

index 8a9f7d15df7233d3cd3ecf885d7ca395ab04d3f2..5e9e828d9d5359f738907745f12ca3fe88f370e8 100644 (file)
@@ -2568,8 +2568,12 @@ Integer_type::create_abstract_integer_type()
 {
   static Integer_type* abstract_type;
   if (abstract_type == NULL)
-    abstract_type = new Integer_type(true, false, INT_TYPE_SIZE,
-                                    RUNTIME_TYPE_KIND_INT);
+    {
+      Type* int_type = Type::lookup_integer_type("int");
+      abstract_type = new Integer_type(true, false,
+                                      int_type->integer_type()->bits(),
+                                      RUNTIME_TYPE_KIND_INT);
+    }
   return abstract_type;
 }
 
index 9c72e611a80f02821ab55f5e2654c2fa9a1375bd..1f4399c446ad905a54a3cb3cd738055647cfa5a0 100644 (file)
    We deliberately don't split the stack in case it does call the
    library function, which shouldn't need much stack space.  */
 
-int IndexByte (struct __go_open_array, char)
+intgo IndexByte (struct __go_open_array, char)
   asm ("bytes.IndexByte")
   __attribute__ ((no_split_stack));
 
-int
+intgo
 IndexByte (struct __go_open_array s, char b)
 {
   char *p;
index 3b4cddd5d86268bf6c84aacf5004e39d8dbdb6c0..d79cba3757b5e48cd908137f94c198b4353aee0f 100644 (file)
@@ -6,14 +6,16 @@
 
 #include <syslog.h>
 
+#include "runtime.h"
+
 /* We need to use a C function to call the syslog function, because we
    can't represent a C varargs function in Go.  */
 
-void syslog_c(int, const char*)
+void syslog_c(intgo, const char*)
   asm ("log_syslog.syslog_c");
 
 void
-syslog_c (int priority, const char *msg)
+syslog_c (intgo priority, const char *msg)
 {
   syslog (priority, "%s", msg);
 }
index 5ff0b09dbb7bfa54356ad44c4fc103229124cc32..c2d3b9fac707e9f47ae295d7895ec181cc406b08 100644 (file)
 #include "arch.h"
 #include "malloc.h"
 
-String Signame (int sig) asm ("syscall.Signame");
+String Signame (intgo sig) asm ("syscall.Signame");
 
 String
-Signame (int sig)
+Signame (intgo sig)
 {
   const char* s = NULL;
   char buf[100];
@@ -27,7 +27,7 @@ Signame (int sig)
 
   if (s == NULL)
     {
-      snprintf(buf, sizeof buf, "signal %d", sig);
+      snprintf(buf, sizeof buf, "signal %ld", (long) sig);
       s = buf;
     }
   len = __builtin_strlen (s);
index 23af18b6c2b304f4ff7d21e5d9e7809d1152f2f9..3b7f572d5a50fd002524132a2a2933a81eae9ec8 100644 (file)
@@ -124,7 +124,7 @@ static uintptr eod[3] = {0, 1, 0};
 static void LostProfileData(void) {
 }
 
-extern void runtime_SetCPUProfileRate(int32)
+extern void runtime_SetCPUProfileRate(intgo)
      __asm__("runtime.SetCPUProfileRate");
 
 // SetCPUProfileRate sets the CPU profiling rate.
index 096856e234c90d4cf45fbcd191500f4cb675dedf..c289bc0bea05f6d891b77cfb292e76fd0e140768 100644 (file)
@@ -106,10 +106,11 @@ __go_map_next_prime (uintptr_t n)
 struct __go_map *
 __go_new_map (const struct __go_map_descriptor *descriptor, uintptr_t entries)
 {
-  intgo ientries;
+  int32 ientries;
   struct __go_map *ret;
 
-  ientries = (intgo) entries;
+  /* The master library limits map entries to int32, so we do too.  */
+  ientries = (int32) entries;
   if (ientries < 0 || (uintptr_t) ientries != entries)
     runtime_panicstring ("map size out of range");
 
index ba6d86c501fc0b169e7086233c42ab9d2454fc29..4c65e21516757eb0a917e98dca77b743773d4fff 100644 (file)
@@ -14,7 +14,7 @@
    characters used from STR.  */
 
 int
-__go_get_rune (const unsigned char *str, size_t len, int *rune)
+__go_get_rune (const unsigned char *str, size_t len, int32 *rune)
 {
   int c, c1, c2, c3, l;
 
index f4c149bb54ef32a6972cf01036721a589a3d9ec8..7fee1da03eb8943065732757aa2065bb60210fff 100644 (file)
@@ -26,6 +26,6 @@ __go_ptr_strings_equal (const String *ps1, const String *ps2)
   return __go_strings_equal (*ps1, *ps2);
 }
 
-extern int __go_get_rune (const unsigned char *, size_t, int *);
+extern int __go_get_rune (const unsigned char *, size_t, int32 *);
 
 #endif /* !defined(LIBGO_GO_STRING_H) */
index 4d5b61a4fd5bb850de826a6d3de1eb8434a406d7..2927351c8a975b740c69588d5c03580149c8399d 100644 (file)
@@ -29,13 +29,13 @@ runtime_printtrace (uintptr *pcbuf, int32 c)
     {
       String fn;
       String file;
-      int line;
+      intgo line;
 
       if (__go_file_line (pcbuf[i], &fn, &file, &line)
          && runtime_showframe (fn.str))
        {
          runtime_printf ("%S\n", fn);
-         runtime_printf ("\t%S:%d\n", file, line);
+         runtime_printf ("\t%S:%D\n", file, (int64) line);
        }
     }
 }
index 43071e581cc485809753f6dcccf2ab1b82e1bc73..b6254a7e53fa6d27f983773ec8e0cf52a5554f82 100644 (file)
@@ -610,11 +610,11 @@ runtime_goroutinetrailer(G *g)
        if(g != nil && g->gopc != 0 && g->goid != 1) {
                String fn;
                String file;
-               int line;
+               intgo line;
 
                if(__go_file_line(g->gopc - 1, &fn, &file, &line)) {
                        runtime_printf("created by %S\n", fn);
-                       runtime_printf("\t%S:%d\n", file, line);
+                       runtime_printf("\t%S:%D\n", file, (int64) line);
                }
        }
 }
index e6281eaf803b2e3b156c76a38533ebd044ce7f72..72e1eb2f8b95691a8a18a4d482fa97cd97d56718 100644 (file)
@@ -341,7 +341,7 @@ int32       runtime_ncpu;
 /*
  * common functions and data
  */
-int32  runtime_findnull(const byte*);
+intgo  runtime_findnull(const byte*);
 void   runtime_dump(byte*, int32);
 
 /*
@@ -614,7 +614,7 @@ extern uintptr runtime_stacks_sys;
 
 struct backtrace_state;
 extern struct backtrace_state *__go_get_backtrace_state(void);
-extern _Bool __go_file_line(uintptr, String*, String*, int *);
+extern _Bool __go_file_line(uintptr, String*, String*, intgo *);
 extern byte* runtime_progname();
 
 int32 getproccount(void);
index d3f0c2d4b9c405e7ccd3a044a74de5630913c995..240ab0ba5e43da2cefff2bc6074108beb2341792 100644 (file)
@@ -54,7 +54,7 @@ func stringiter(s String, k int) (retk int) {
 out:
 }
 
-func stringiter2(s String, k int) (retk int, retv int) {
+func stringiter2(s String, k int) (retk int, retv int32) {
        if(k >= s.len) {
                // retk=0 is end of iteration
                retk = 0;